PHP 错误总结
1. Data too long for column `Title` at row 1 错误解决方法:(1). 确保数据库结构是 utf-8 的, php 文件是 utf-8 格式的.
(2). 在php 顶部加上: header('Content-type: text/html; charset=utf-8');
(3). 发生以上错误可能是因为你要插入的字符集是 GB2312, 所以需要我们把改字符转为 utf-8的。
所以: $title = mb_convert_encoding($title,"UTF-8", "GBK"); 即可解决该问题。
2. Smarty 错误:
Smarty 3 抛出 Uncaught exception 'Exception' with message 'Syntax Error in template ..... - Unexpected " }", expected one of: "}" , "*" , "/" , "%"
可能是是由于 {if .... } 在 } 之前多了一个空格的原因。 (如果带空格在 smarty 3中会被看作 javascript的代码片段)
3. Class 'XSLTProcessor' not found in...... 错误
(1). 启用 PHP 对 xslt 的支持, 在 php.ini 文件中取消 php_xsl.dll 前的注释.
4. file_get_contents() 访问远程文件或者类似 http://www.example.com 这样的文件不会有问题,但如果访问本地文件,比如访问 b.php ,可以这样:
$data = eval('?'.'>'.file_get_contents('b.php',1).'<'.'?');
echo $data;
页:
[1]