一个小正则,可以删除 多行注释:/\*[\S\s]+?(?=\*/)\*/
很简单,就这么一个正则,自己做一个备份。
Submitted by gouki on 2012, April 8, 11:43 AM
一个小正则,可以删除 多行注释:/\*[\S\s]+?(?=\*/)\*/
很简单,就这么一个正则,自己做一个备份。
Submitted by gouki on 2012, April 6, 7:25 PM
不清楚这些博客是否还会连载,要知道连载这东西真的很耗精力,如果编辑器不好、如果不能自动保存,真的很可能是会失去连载的信息的。事实上,我就是因为这些问题放弃了一些文章的连载。辛苦写了上千字,结果因为编辑器的问题一下子消失了。
再过一段时间,我还是会准备将博客转换到typecho或者wordpress上,毕竟这两个博客软件都是可以支持xmlrpc来投稿的。这样,我就可以用第三方软件来投稿了。(firefox有插件,黑黑)
上链接了,不然会被人骂:(如果有更新,我这里也会同步更新链接,或者你就直接移步该作者的博客吧)
暂时只有5篇关于PHP的,这还有一篇对话也可以看看:PHP 跟老大的对话。
因为其中这一段可以拿来共勉:
Submitted by gouki on 2012, April 5, 9:06 AM
Yii框架的使用者越来越多,虽然大多数情况下都能够被使用的很正常,但偶尔还是有一些小问题,比如mysql对库名和表名区分大小写,但字段名不区分;这个问题就给Yii框架使用者带来很大的烦恼,特别是这个表还不是自己设计的,只是你拿来使用的,这个郁闷程度啊。
于是有人提醒我,应该这么用,在components中的db数组里加入:attributes=>array(PDO::ATTR_CASE,PDO::CASE_LOWER),以达到强制小写的目的,嗯,想法是好的,但是gii没法用了,gii直接报错,排查了半天,发现可能是CMysqlSchema这个类中的createColumn方法导致的错误,因为当你设置为列名小写后,这个方法中的一些判断却还是用的大写,于是很多变量就找不到了,没有办法继续下一步操作,于是我改了一下这个函数:
当然上面的代码很粗燥,我也只是先临时解决这个问题,这么写之后,马上gii就恢复正常了。黑黑
顺便再说一个技巧:以前用gii的时候,对于生成model类都是一个个的输入一个个的生成,总想着应该可以批量生成,但一直不知道如何操作,直到昨天在解决上面的问题时,发现原来在gii里有这样一段代码:
我晶啊,原来那个表名可以写成*啊,这样就是自动生成整个数据库的model了,哎,以前居然一直没在意。
Submitted by gouki on 2012, March 20, 11:05 PM
http://www.microsoft.com/download/en/confirmation.aspx?id=20098
其实在很久前就有这玩意了,现在居然是3.0了。在win下用这个驱动好啊,支持最新的Sql server,而且速度很快。同时,它居然还支持了PDO。。。
下载下来很方便,有几种不同的文件,根据你当前的情况来设置:
Perform the following steps to download and install the Microsoft Drivers for PHP for SQL Server:
1. Download SQLSRV30.EXE to a temporary directory
2. Run SQLSRV30.EXE
3. When prompted, enter the path to the PHP extensions directory
4. After extracting the files, read the Installation section of the SQLSRV30_Readme.htm file for next steps
看着readme一步一步就Over了。
08年的时候根据第一版的文件写过一个很简单的连接库,替换掉了当时discuz的sql连接库。现在。。。还是用PDO吧
Submitted by gouki on 2012, March 19, 9:28 PM
PDO_SQLSRV is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MS SQL Server (starting with SQL Server 2005) and SQL Azure databases.
The PDO_SQLSRV extension is enabled by adding appropriate DLL file to your PHP extension directory and the corresponding entry to the php.ini file. The PDO_SQLSRV download comes with several driver files. Which driver file you use will depend on 3 factors: the PHP version you are using, whether you are using thread-safe or non-thread-safe PHP, and whether your PHP installation was compiled with the VC6 or VC9 compiler. For example, if you are running PHP 5.3, you are using non-thread-safe PHP, and your PHP installation was compiled with the VC9 compiler, you should use the php_pdo_sqlsrv_53_nts_vc9.dll file. (You should use a non-thread-safe version compiled with the VC9 compiler if you are using IIS as your web server). If you are running PHP 5.2, you are using thread-safe PHP, and your PHP installation was compiled with the VC6 compiler, you should use the php_pdo_sqlsrv_52_ts_vc6.dll file.
For more information about system requirements, see » SQLSRV System Requirements.
The PDO_SQLSRV extension is only compatible with PHP running on Windows. For Linux, see ODBC and » Microsoft's SQL Server ODBC Driver for Linux.
To access data in a SQL Server 2005 or later database using the Microsoft Drivers for PHP for SQL Server, you must have the following components installed on your computer:
Supported operating systems for version 3.0 of the driver include:
Windows Server 2008 R2 SP1
Windows Vista SP2
Windows Server 2008 SP2
Windows 7 SP1
Supported operating systems for version 2.0 of the driver include:
Supported operating systems for version 2.0 of the driver include:
Windows Server 2003 Service Pack 1
Windows XP Service Pack 3
Windows Vista Service Pack 1 or later
Windows Server 2008
Windows Server 2008 R2
Windows 7
PHP 5. For information about how to download and install the latest stable binaries, visit http://php.net.
Microsoft Drivers for PHP for SQL Server, version 3.0 requires PHP 5.3.0 or later. If possible, use PHP 5.3.6, or later. The version 2.0 driver works with PHP 5.2.4 or later. If possible, use PHP 5.2.13, or later.
A version of the driver file must be in your PHP extension directory. See Driver Versions later in this topic for information about the different driver files. See Loading the Microsoft Drivers for PHP for SQL Server for information on configuring the driver for the PHP runtime.
(See The Data Center for the Microsoft Drivers for PHP for SQL Server for information on where to download the Microsoft Drivers for PHP for SQL Server.)
A Web server. Your Web server must be configured to run PHP. For information about hosting PHP applications with Internet Information Services (IIS) 6.0, see Using FastCGI to Host PHP Applications on IIS 6.0. For information about hosting PHP applications with IIS 7.0, see Using FastCGI to Host PHP Applications on IIS 7.0.
The Microsoft Drivers for PHP for SQL Server has been tested using IIS 6 and IIS 7 with FastCGI.
The x86 version of SQL Server Native Client is required on the computer where PHP is running. If you are using a 64-bit operating system, the x86 version of SQL Server Native Client will be installed with the x64 version of SQL Server Native Client (do not install the x86 version of SQL Server Native Client on an x64 operating system).
If you are using the SQLSRV driver, sqlsrv_client_info will return information about which version of SQL Server Native Client is being used by the Microsoft Drivers for PHP for SQL Server. If you are using the PDO_SQLSRV driver, you can use PDO::getAttribute to discover the version.
Version 3.0 of the driver requires Microsoft SQL Server 2012 Native Client. You can download Microsoft SQL Server 2012 Native Client from the SQL Server 2012 feature pack page.
Version 2.0 of the driver requires Microsoft SQL Server 2008 R2 Native Client. Click on the appropriate link below:
This section lists the drivers that are installed for version 2.0 and version 3.0 of the Microsoft Drivers for PHP for SQL Server. PHP version 5.2 is not supported in version 3.0 of the Microsoft Drivers for PHP for SQL Server.
Follow the installation instructions in Loading the Driver to configure the driver for use with the PHP runtime.
Microsoft Drivers 2.0 for PHP for SQL Server installs several versions of the driver:
Driver file |
PHP version |
Thread safe? |
Use with PHP .dll |
---|---|---|---|
php_sqlsrv_53_nts_vc6.dll php_pdo_sqlsrv_53_nts_vc6.dll |
5.3 |
no |
php5.dll |
php_sqlsrv_53_nts_vc9.dll php_pdo_sqlsrv_53_nts_vc9.dll |
5.3 |
no |
php5.dll |
php_sqlsrv_53_ts_vc6.dll php_pdo_sqlsrv_53_ts_vc6.dll |
5.3 |
yes |
php5ts.dll |
php_sqlsrv_53_ts_vc9.dll php_pdo_sqlsrv_53_ts_vc9.dll |
5.3 |
yes |
php5ts.dll |
php_sqlsrv_52_nts_vc6.dll php_pdo_sqlsrv_52_nts_vc6.dll |
5.2 |
no |
php5.dll |
php_sqlsrv_52_ts_vc6.dll php_pdo_sqlsrv_52_ts_vc6.dll |
5.2 |
yes |
php5ts.dll |
If the name of the driver file contains "vc9", it should be used with a PHP version compiled with Visual C++ 9.0.
Microsoft Drivers 3.0 for PHP for SQL Server installs several versions of the driver:
Driver file |
PHP version |
Thread safe? |
Use with PHP .dll |
---|---|---|---|
php_sqlsrv_53_nts.dll php_pdo_sqlsrv_53_nts.dll |
5.3 |
no |
php5.dll |
php_sqlsrv_53_ts.dll php_pdo_sqlsrv_53_ts.dll |
5.3 |
yes |
php5ts.dll |