<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CNlaoKe&#039;s Blog &#187; PHP</title>
	<atom:link href="http://blog.cnlaoKe.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.cnlaoKe.com</link>
	<description>Rome was not built in a day!</description>
	<lastBuildDate>Thu, 02 Feb 2012 09:30:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>自动表单生成工具</title>
		<link>http://blog.cnlaoKe.com/2011/04/07/416/</link>
		<comments>http://blog.cnlaoKe.com/2011/04/07/416/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 14:41:21 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2011/04/07/416/</guid>
		<description><![CDATA[http://www.phpform.org/
]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2011/04/07/416/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10分钟学会ThinkPHP数据分页</title>
		<link>http://blog.cnlaoKe.com/2011/04/07/415/</link>
		<comments>http://blog.cnlaoKe.com/2011/04/07/415/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 13:14:24 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2011/04/07/415/</guid>
		<description><![CDATA[http://bbs.phpchina.com/thread-52813-1-1.html
需要修改的两个地方
② 扩展类库有了，没提示错误了，可还是不能正确显示出想要的结果！查看“页面Trace信息”，原来是SQL有问题 SELECT COUNT() AS tp_count FROM `think_demo` LIMIT 1，分析得出教程的这句$count = $test->count(&#8221;,&#8217;id&#8217;) 代码有问题,改成 $count = $test->count(&#8217;id&#8217;) 终于看到上一页下一页的超链接了。尽信书不如无书！
③ 用教程的 $list = $test->findall(&#8221;,$fields,&#8217;id desc&#8217;,$p->firstRow.&#8217;,&#8217;.$p->listRows); 这句代码我怎么也得不到想要的结果，我也不想去深入了解 findall 方法的各个参数的使用方法。于是改成 $list = $test->query(&#8221;select $fields from think_demo order by id desc limit $p->firstRow,$p->listRows&#8221;) 。再运行，这次终于把分页搞掂出来了！
]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2011/04/07/415/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>thinkphp URL_MODEL 模式2 使用的.htcaccess文件</title>
		<link>http://blog.cnlaoKe.com/2011/04/07/414/</link>
		<comments>http://blog.cnlaoKe.com/2011/04/07/414/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 12:11:01 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2011/04/07/414/</guid>
		<description><![CDATA[
&#60;IfModule mod_rewrite.c&#62;
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
&#60;/IfModule&#62;

]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2011/04/07/414/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用 CakePHP 快速打造 Web 站点</title>
		<link>http://blog.cnlaoKe.com/2011/04/07/413/</link>
		<comments>http://blog.cnlaoKe.com/2011/04/07/413/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 02:23:06 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2011/04/07/413/</guid>
		<description><![CDATA[http://www.ibm.com/developerworks/cn/opensource/tutorials/os-php-cake1/index.html
]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2011/04/07/413/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notice: Undefined variable解决办法</title>
		<link>http://blog.cnlaoKe.com/2011/01/25/411/</link>
		<comments>http://blog.cnlaoKe.com/2011/01/25/411/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 09:29:05 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2011/01/25/411/</guid>
		<description><![CDATA[PHP默认配置会报这个错误，我的PHP版本是5.2.13,存在这个问题：
　　
　　Notice: Undefined variable
　　
　　这就是将警告在页面上打印出来，虽然这是有利于暴露问题，但实现使用中会存在很多问题。
　　
　　需要设置显示错误级别，来解决问题。
　　
　　网络上的通用解决办法是修改php.ini的配置：
　　
　　解决方法：
　　
　　1) error_reporting设置：
　　
　　找到error_reporting = E_ALL
　　
　　修改为error_reporting = E_ALL &#038; ~E_NOTICE
　　
　　2) register_globals设置：
　　
　　找到register_globals = Off
　　
　　修改为register_globals = On
　　
　　我发现在php代码中直接使用
　　　　
　　error_reporting(E_ALL &#038; ~E_NOTICE);
　　
　　可以解决这个问题，小技巧记一下，呵呵。
]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2011/01/25/411/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php 中文分词系统SCWS</title>
		<link>http://blog.cnlaoKe.com/2011/01/18/410/</link>
		<comments>http://blog.cnlaoKe.com/2011/01/18/410/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 03:42:56 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2011/01/18/410/</guid>
		<description><![CDATA[http://www.ftphp.com/scws/index.php
留个记号 
]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2011/01/18/410/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php 文件下载弹出&#8211;header部分</title>
		<link>http://blog.cnlaoKe.com/2011/01/17/409/</link>
		<comments>http://blog.cnlaoKe.com/2011/01/17/409/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 04:50:00 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2011/01/17/409/</guid>
		<description><![CDATA[其他页面附件下载的连接为：
&#60;a href="DownLoadFile.php?download=.%2FuploadFiles%2Fbug%2F200809%2F11%2FBJ190809110015%2F%CE%B4%C3%FC%C3%FB_998e57ad2365623b9f19ff0c895705bb.bmp"&#62;未命名&#60;/a&#62;

DownLoadFile.php代码如下：
&#60;/pre&#62;
&#60;?php
 if( isset( $_REQUEST[&#34;download&#34;] ) )
 {
 $tfile = $_REQUEST[&#34;download&#34;];

 if (file_exists($tfile))
 {
 $downfilename=substr($tfile,strrpos($tfile, &#34;/&#34;)+1);
 //文件保存的名字可以修改为你需要的，可以和链接给的名字不一样
 // Prompt the user to download the new torrent file.
 header( &#34;Content-type: application/octet-stream\n&#34; );
 header( &#34;Content-disposition: attachment; filename=$downfilename\n&#34; );
 header( &#34;Content-transfer-encoding: binary\n&#34;);
 header( &#34;Content-length: &#34; . @filesize($tfile ) . &#34;\n&#34; );
 // Send the torrent file
 $fp = [...]]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2011/01/17/409/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysqli_set_charset</title>
		<link>http://blog.cnlaoKe.com/2010/12/10/385/</link>
		<comments>http://blog.cnlaoKe.com/2010/12/10/385/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 14:23:40 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2010/12/10/385/</guid>
		<description><![CDATA[http://php.chinaunix.net/manual/zh/function.mysqli-set-charset.php
]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2010/12/10/385/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转]深入理解SET NAMES和mysql(i)_set_charset的区别</title>
		<link>http://blog.cnlaoKe.com/2010/12/10/384/</link>
		<comments>http://blog.cnlaoKe.com/2010/12/10/384/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 14:22:34 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2010/12/10/384/</guid>
		<description><![CDATA[# 作者: laruence(http://www.laruence.com)
# 原文地址: http://www.laruence.com/2010/04/12/1396.html
最近公司组织了个PHP安全编程的培训, 其中涉及到一部分关于Mysql的”SET NAMES”和mysql_set_charset (mysqli_set_charset)的内容:
说到, 尽量使用mysqli_set_charset(mysqli:set_charset)而不是”SET NAMES”, 当然, 这个内容在PHP手册中也有叙及, 但是却没有解释为什么.
最近有好几个朋友问我这个问题, 到底为什么?
问的人多了, 我也就觉得可以写篇blog, 专门介绍下这部分的内容了.
首先, 很多人都不知道”SET NAMES”到底是做了什么,
我之前的文章深入MySQL字符集设置中, 曾经介绍过character_set_client/character_set_connection/character_set_results这三个MySQL的”环境变量”, 这里再简单介绍下,
这三个变量, 分别告诉MySQL服务器, 客户端的编码集, 在传输给MySQL服务器的时候的编码集, 以及期望MySQL返回的结果的编码集.
比如, 通过使用”SET NAMES utf8″, 就告诉服务器, 我用的是utf-8编码, 我希望你也给我返回utf-8编码的查询结果.
一般情况下, 使用”SET NAMES”就足够了, 也是可以保证正确的. 那么为什么手册又要说推荐使用mysqli_set_charset(PHP>=5.0.5)呢?
首先, 我们看看mysqli_set_charset到底做了什么(注意星号注释处, mysql_set_charset类似):
//php-5.2.11-SRC/ext/mysqli/mysqli_nonapi.c line 342
PHP_FUNCTION(mysqli_set_charset)
{
    MY_MYSQL            *mysql;
  [...]]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2010/12/10/384/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP操作MySQL数据库基础代码</title>
		<link>http://blog.cnlaoKe.com/2010/12/10/383/</link>
		<comments>http://blog.cnlaoKe.com/2010/12/10/383/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 14:00:41 +0000</pubDate>
		<dc:creator>CNlaoKe</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.cnlaoKe.com/2010/12/10/383/</guid>
		<description><![CDATA[
1. 建立数据库连接
复制代码 代码如下:
&#60;?php
$mysqli = new mysqli(&#8221;localhost&#8221;,&#8221;root&#8221;,&#8221;",&#8221;mydb&#8221;);
?&#62;
建立一个数据库连接需要四个参数，分别为数据库地址、数据库访问用户名、数据库访问密码、数据库名称。除了使用上面的mysqli对象的构造方法建立数据库连接外，还可以调用其connect方法建立数据库的连接。
复制代码 代码如下:
&#60;?php
$mysqli = new mysqli();
$mysqli-&#62;connect(&#8221;localhost&#8221;,&#8221;root&#8221;,&#8221;",&#8221;mydb&#8221;);
?&#62;
还可以通过mysqli对象的构造方法建立数据连接，通过select_db方法指定要访问的数据库。
复制代码 代码如下:
&#60;?php
$mysqli = new mysqli(&#8221;localhost&#8221;,&#8221;root&#8221;,&#8221;");
$mysqli-&#62;select_db(&#8221;mydb&#8221;);
?&#62;
通过mysqli对象的errno属性获取当前连接的错误号，如果当前连接没有任何错误，错误号返回为0。
复制代码 代码如下:
&#60;?php
$mysqli = new mysqli(&#8221;localhost&#8221;,&#8221;root&#8221;,&#8221;");
$mysqli-&#62;select_db(&#8221;mydb&#8221;);
if($mysqli-&#62;errno == 0) //判断当前连接是否成功
{
}
else
{
echo &#8220;The Connection is Error!&#8221;;
exit();
}
?&#62;
当然可以通过mysqli对象的error属性获取当前连接的错误信息，如果没有错误，返回“”。
复制代码 代码如下:
&#60;?php
$mysqli = new mysqli(&#8221;localhost&#8221;,&#8221;rootsss&#8221;,&#8221;");
$mysqli-&#62;select_db(&#8221;mydb&#8221;);
if($mysqli-&#62;errno == 0) //判断当前连接是否成功
{
}
else
{
echo $mysqli-&#62;error; //输出当前错误信息
exit();
}
?&#62;
2.查询数据库
查询数据库可以使用mysqli对象的query方法，该方法返回查询数据库的结果集。
语法为：$mysqli-&#62;query(查询语句，查询模式);
查询模式有两种：
①  MYSQLI_STORE_RESULT。将结果作为一个缓存集进行返回，这说明可以立即对整个结果集进行导航。该设置为默认设置。结果集查询出来后就放 入内存中，这就代表如果结果集内数据量很大则会占用较多的内存。但是利用这种方式我们可以很容易知道一个查询返回了多少行记录或希望立即跳到结果集的某一 行。
② MYSQLI_USE_RESULT。将结果集作为一个非缓存集返回。这就代表会根据需要从数据库服务器获取结果集，对于较大的结果集数据这样做可以提高性能。但是会导致很多对结果集的操作受到限制，比如获取查询行数等。
复制代码 代码如下:
&#60;?php
$mysqli = new mysqli(&#8221;localhost&#8221;,&#8221;root&#8221;,&#8221;");
$mysqli-&#62;select_db(&#8221;mydb&#8221;);
if($mysqli-&#62;errno == 0) //判断当前连接是否成功
{
$sql = &#8220;SELECT * FROM student&#8221;;
$result = $mysqli-&#62;query($sql);
echo &#8220;Result row [...]]]></description>
		<wfw:commentRss>http://blog.cnlaoKe.com/2010/12/10/383/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

