用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2807|回复: 9
收起左侧

[已解决] 求助求助。CI2.1中使用base_url()函数时出错

[复制链接]
发表于 2012-6-29 11:04:29 | 显示全部楼层 |阅读模式
CI中使用base_url()函数时报如下错误:
A PHP Error was encountered
Severity: Warning
Message:  main(): It is not safeto rely on the system's timezone settings. You are *required* to usethe date.timezone setting or the date_default_timezone_set() function.In case you used any of those methods and you are still getting thiswarning, you most likely misspelled the timezone identifier. We selected'UTC' for '8.0/no DST' instead
Filename: views/welcome_message.php
Line Number: 12


在config.php中设置了时区为:
date_default_timezone_set("PRC");
它就不报错了,但是就不显示内容了,但是它是有错误的:

各位大大,知道什么原因吗?
 楼主| 发表于 2012-6-29 11:42:19 | 显示全部楼层
补充:只要有设置时区,PHP错误就不会被打印出来。。。
发表于 2012-6-29 12:01:39 | 显示全部楼层
使用base_url()时看看是否需要加载url helper
发表于 2012-6-29 15:07:25 | 显示全部楼层
会这样吗?有代码才有真相
 楼主| 发表于 2012-6-29 16:39:14 | 显示全部楼层
huboo82 发表于 2012-6-29 12:01
使用base_url()时看看是否需要加载url helper

谢谢,使用这个确实要加载。url helper
发表于 2012-6-29 17:05:48 | 显示全部楼层
普林 发表于 2012-6-29 16:39
谢谢,使用这个确实要加载。url helper

那也不是报这个错吧
发表于 2012-6-29 17:40:13 | 显示全部楼层
php 3.8以上版本会要求设置时区
发表于 2012-6-29 23:31:16 | 显示全部楼层
huboo82 发表于 2012-6-29 17:40
php 3.8以上版本会要求设置时区

LZ使用CI时报的这个错跟PHP是否设置时区有什么必然的联系吗?
求解
 楼主| 发表于 2012-7-3 10:17:07 | 显示全部楼层
浪迹天涯 发表于 2012-6-29 23:31
LZ使用CI时报的这个错跟PHP是否设置时区有什么必然的联系吗?
求解

只要有设置时区(在config.php或index.php页面),PHP错误就不会被打印出来,只显示一个空白页面。
发表于 2012-7-3 10:54:23 | 显示全部楼层
时区设置最好在php.ini里设置

本地开发环境把PHP的错误报告打开
error_reporting = E_ALL

CI的入口文件index.php 设置
define('ENVIRONMENT', 'development');


你最好先检查下你的本地PHP环境先

本版积分规则