十万个为什么-php

Q: Question, A: Answer.

-------------------------------------------------------------------------------------

Q: 中文乱码?
A: header("Content-type: text/html;charset=utf-8");

Q: POST Content-Length of 1208346246 bytes exceeds the limit of 8388608 bytes in Unknown
A: php最大上传size为8M。解决方案:
1. phpinfo()找到php.ini的位置。
2. 修改php.ini中的post_max_size及upload_max_filesize(后者需设置得更大一点)
3. 重启服务

Q: 文件明明存在,file_exists()却返回false?
A: file_exists()搜索文件时,需要对目标文件所在的目录及父目录有执行权限(x)。如果没有执行权限,目录将无权被搜索。
解决方案:给目录执行权限。chmod("parentpath/",0777);

posted on 2017-03-06 19:26  等不到来世  阅读(145)  评论(0)    收藏  举报

导航