草庐IT

open_date

全部标签

php - 使用 Zend_Date 处理日期和时区

我有一个使用Zend_Date来显示日期的应用程序。Zend_Date实例是使用来自MySQL的日期时间数据、用户输入和当前日期创建的。我希望我的用户能够指定他们的时区,并且所有日期都以他们的本地时间显示。目前我的代码是这样工作的:$date='2009-01-0110:30:00';$date=newZend_Date($date,Zend_Date::ISO_8601);echo$date->get(Zend_Date::TIME_MEDIUM);//10:30:00$date->setTimezone('Australia/ACT');echo$date->get(Zend_Da

php - 警告 : file_get_contents: failed to open stream: Redirection limit reached, 中止

我在这个网站上阅读了20多个相关问题,在Google中搜索但没有用。我是PHP的新手,正在使用PHPSimpleHTMLDOMParser来获取URL。虽然此脚本适用于本地测试页面,但它不适用于我需要该脚本的URL。这是我为此编写的代码,遵循PHP简单DOM解析器库附带的示例文件:find('li.nameul#generalListing')as$e)echo$e->plaintext;?>这是我收到的错误消息:Warning:file_get_contents(http://www.farmersagent.com/Results.aspx?isa=1&name=A&

PHP 警告 : include_once() Failed opening '' for inclusion (include_path ='.;C:\xampp\php\PEAR' )

我知道这个错误很常见,我试着用谷歌搜索,我试过这些技巧都无济于事。所以我的设置是,我有3个目录:类->常量页数初始化控制编辑:我有新的错误:*警告:require_once(initcontrols/config.php)[function.require-once]:无法打开流:*中没有这样的文件或目录下面是我的代码片段:require_once("initcontrols/config.php");这里还缺少什么?提前感谢所有帮助。 最佳答案 如果当前文件位于initcontrols所在的同一目录中,这应该有效:

php - date() 和 gmdate() 的不同结果

我发现了一些我无法真正解释的东西,也许这里有人可以给我一个提示。我有以下测试代码,它使用date()和gmdate():结果让我吃惊:in2013date:31.03.201301:00:00gmdate:31.03.201300:00:00in2014date:31.03.201401:00:00gmdate:30.03.201423:00:00Defaulttimezone:Europe/Berlin2014年的差异从何而来?我的第一个想法是夏令时,但为什么在2013年没有效果?为什么2014年时差2小时,而2013年时差只有1小时? 最佳答案

PHP open_basedir - 返回值?

我想在php脚本中返回open_basedir的值。我该怎么做?如果值为空白,它应该回显为空白..谢谢! 最佳答案 open_basedir是在php.ini中配置的设置因此,您可以使用ini_get获取其当前值:echoini_get('open_basedir');例如,如果open_basedir在我的php.ini文件中以这种方式定义:open_basedir=/data/www:/var/www:/home/squale/developpement/tests然后,下面的代码部分:var_dump(ini_get('ope

Mac OS X 中的 PHP : Shows up the PHP code when opening the page

在我的本地主机中打开PHP页面时显示PHP源代码。这对我来说很奇怪。我在MacOSXSnowLeopard上使用PHP5.3.1。$php--versionPHP5.3.1(cli)(built:Feb28201015:02:51)Copyright(c)1997-2009ThePHPGroupZendEnginev2.3.0,Copyright(c)1998-2009ZendTechnologies我在我的机器上运行默认的httpd网络服务器。/etc/apache2/httpd.conf文件包含以下行来加载php模块:LoadModulephp5_modulelibexec/apa

PHP - date() 与 date.timezone/date_default_timezone_set()

我刚买了一台新电脑,我一直在设置PHP/MySQL/数据库等...我想我就快到了,除了它抛出了这个曲线球。我的登录脚本工作正常,但现在它发出以下警告(它弄乱了JSON)。Warning:date()[function.date]:Itisnotsafetorelyonthesystem'stimezonesettings.Youarerequiredtousethedate.timezonesettingorthedate_default_timezone_set()function.Incaseyouusedanyofthosemethodsandyouarestillgetting

php - 如何计算两个 Zend_Date 对象之间的差异,以月为单位

我有两个Zend_Date类的对象,我想计算它们在整个日历月中的差异。我该怎么做?sub($d2)->get(Zend_Date::MONTH);assert($months==-25);//failurehere提前致谢! 最佳答案 在Zend_Measure_Time的帮助下,您可以轻松获得您想要的任何差异:$timeNow=newZend_Date();$timeThen=newZend_Date("2011-05-21T10:30:00");$difference=$timeNow->sub($timeThen);$meas

php - 如何修复 XML "Opening and ending tag mismatch error"?

我正在尝试修复包含数千行错误的XML文件:Openingandendingtagmismatcherror我现在正在使用simpleXML来解析这个文件,所以在用这个库解析之前我需要修复XML文件:现在我正在尝试这个解决方案,但这还不够:libxml_use_internal_errors(true);$xml=@simplexml_load_file($temp_name);$errors=libxml_get_errors();foreach($errorsas$error){if(strpos($error->message,'Openingandendingtagmismatc

php - 权限被拒绝 : httpd: could not open error log file/etc/httpd/logs/error_log

当我想在centOS6.7上重启httpd服务时出现以下错误:/etc/init.d/httpdrestartStoppinghttpd:[FAILED]Startinghttpd:(13)Permissiondenied:httpd:couldnotopenerrorlogfile/etc/httpd/logs/error_log.Unabletoopenlogs[FAILED]这是错误日志:ls-Z/etc/httpd/logs/error_log-rw-r--r--.rootrootunconfined_u:object_r:var_t:s0/etc/httpd/logs/err