在CI框架中,当数据库出现错误的时候,在windows系统中会提示:
Error Number: 1146
Table ‘article.hd_article0’ doesn’t exist
SELECTtitle
,aid
FROM (hd_article0
) ORDER BYtime
desc LIMIT 10
Filename: E:\wamp\www\article\system\database\DB_driver.php
Line Number: 330
不管是哪个文件中的SQL语句错误,都定位到DB_driver.php的330行,这显然是不正确的。
而在Linux系统中则一切正常:
Error Number: 1146
Table ‘article.hd_article0’ doesn’t exist
SELECTtitle
,aid
FROM (hd_article0
) ORDER BYtime
desc LIMIT 10
Filename: /var/www/html/article/models/article_model.php
Line Number: 38
解决方法:
在system/database/DB_driver.php文件中找到:if (isset($call['file']) && strpos($call['file'], BASEPATH.'database') === FALSE)
改为:if (isset($call['file']) && strpos($call['file'], FCPATH.SYSDIR.DIRECTORY_SEPARATOR.'database') === FALSE)
修改后的显示:
Error Number: 1146
Table ‘article.hd_article0’ doesn’t exist
SELECTtitle
,aid
FROM (hd_article0
) ORDER BYtime
desc LIMIT 10
Filename: E:\wamp\www\article\application\models\article_model.php
Line Number: 38