首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

php读取资料

2012-12-26 
php读取文件1。php存文件的时候$testfilename2居然是非要单引号才行,要不然用双引号会报错,以后用变量的时

php读取文件

1。php存文件的时候$testfilename2居然是非要单引号才行,要不然用双引号会报错,以后用变量的时候应该多用单引号

?

?

$testfilename2='D:\ProgramFiles2\AppServ\www\catch28\admin\testmethod6.html';//文件名,可以为.php或者.txt等文本文件

file_put_contents($testfilename,'<!--resultpage-->');



2。mysql_free_result() 在update的操作的时候不需要调用:




//...CONNECT TO DATABASE...$query = "SELECT * FROM employees WHERE age >= 30";if ($result = mysql_query($query)) {while ($row = mysql_fetch_array($result)) {//...DO SOMETHING HERE...}mysql_free_result($result); //free the query results from memory}///...CLOSE YOUR DATABSE CONNECTION...?But, if you have strict PHP warnings enabled on your server, you maystart getting the warning above for some (but not all) of your queries.I had a really hard time tracking this problem down, but I finallyfound it here. You only use mysql_free_result()for the following query types: SELECT, SHOW, EXPLAIN, and DESCRIBE. So,if you perform an UPDATE query, it doesn’t return a valid resource andthrows the warning when you call mysql_free_result(). Duh.

热点排行