ecshop Undefined variable: data in 的问题处理方法
2012-10-30 15:35
337 查看
经过一个上午的查询资料,我发现了别人忽略的一个地方,在includes文件下有一个叫lib_base.php的文件,里面存着这样的两个函数
函数一:
另一个函数
这两个函数就是控制读出和写入缓存的,在各个页面中都有被用到。而从上面的错误信息分析来看,只有不让它写入到temp文件夹下就能解决问题,也就是缓存的屏蔽,将这两个函数,在第一个 if 前面加上
直接屏蔽掉功能,这样改过之后,(测试之前应该删除原有的除index.htm以 外的文件,然后通过反复访问进行测试缓存的写入)我测试了一下,temp/static_caches/文件夹下不再写入缓存文件了,只保留有 index.htm,也就是不会再出现刚开始的那种错误了,因为写入和读出都被屏蔽了。最直接是页面的错误消失了,网站恢复了正常,让人感到欣慰
如果以上都解决不了,你不妨查看一下,是否你的空间满了,很多人曾经遇到过这样的问题!
函数一:
read_static_cache()
/** * 读结果缓存文件 * * @params string $cache_name * * @return array $data */ function read_static_cache($cache_name) { if ((DEBUG_MODE & 2) == 2) { return false; } static $result = array(); if (!emptyempty($result[$cache_name])) { return $result[$cache_name]; } $cache_file_path = ROOT_PATH . ’/temp/static_caches/’ . $cache_name . ’.php’; if (file_exists($cache_file_path)) { include_once($cache_file_path); $result[$cache_name] = $data; return $result[$cache_name]; } else { return false; } }
另一个函数
write_static_cache()
/** * 写结果缓存文件 * * @params string $cache_name * @params string $caches * * @return */ function write_static_cache($cache_name, $caches) { if ((DEBUG_MODE & 2) == 2) { return false; } $cache_file_path = ROOT_PATH . ’/temp/static_caches/’ . $cache_name . ’.php’; $content = ”<?php\r\n”; $content .= ”\$data = ” . var_export($caches, true) . ”;\r\n”; $content .= ”?>”; file_put_contents($cache_file_path, $content, LOCK_EX); }
这两个函数就是控制读出和写入缓存的,在各个页面中都有被用到。而从上面的错误信息分析来看,只有不让它写入到temp文件夹下就能解决问题,也就是缓存的屏蔽,将这两个函数,在第一个 if 前面加上
return false;
直接屏蔽掉功能,这样改过之后,(测试之前应该删除原有的除index.htm以 外的文件,然后通过反复访问进行测试缓存的写入)我测试了一下,temp/static_caches/文件夹下不再写入缓存文件了,只保留有 index.htm,也就是不会再出现刚开始的那种错误了,因为写入和读出都被屏蔽了。最直接是页面的错误消失了,网站恢复了正常,让人感到欣慰
如果以上都解决不了,你不妨查看一下,是否你的空间满了,很多人曾经遇到过这样的问题!
相关文章推荐
- Notice: Undefined variable: data in /var/www/html/bbeden/modoer/ecshop/includes/lib_base.php on line
- Notice: Undefined variable: data in XX ecshop的屏蔽静态缓存解决方法
- (转载)Undefined variable: PHP_SELF的问题解决方法
- Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery() 问题处理方法
- hadoop 安装出现的几种异常的处理方法,hadoop无法启动,no namenode to stop问题的解决方法,no datanode
- SharePoint 2007运行 Edit In DataSheet 时在IE 6下页面卡死的分析和处理方法
- Notice: Undefined variable另类处理方法
- DataForm中包含TabControl控件,FindNameInContent方法无法获取未选中TabItem里的控件问题
- ecshop建站问题:Strict Standards: Redefining already defined constructor for class alipay in /data/web/in
- 问题-Delphi7中JSON遍历节点不支持使用IN处理方法?
- PHP Notice: Undefined index和Undefined variable问题的解决方法:
- DataForm中包含TabControl控件,FindNameInContent方法无法获取未选中TabItem里的控件问题
- SharePoint 2007运行 Edit In DataSheet 时在IE 6下页面卡死的分析和处理方法
- Redmine配置问题1 --NameError in AccountController#login undefined local variable or method`salt' for
- Reference to undefined variable argLine 与Eclipse TestNg 问题处理
- 对于php实现soap代理的一个常见问题:Class 'SoapClient' not found in PHP的处理方法
- hadoop 安装出现的几种异常的处理方法,hadoop无法启动,no namenode to stop问题的解决方法,no datanode
- 开发新浪微博应用出现以下问题Fatal error:Call to undefined function curl_init() in错误的解决方法
- 【转载】如何将dede织梦data目录正确迁移及引起的问题解决方法
- python处理字符串时出现的错误'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)" 解决方法