草庐IT

parse_requirements

全部标签

php - date_parse_from_format 到 unix 时间戳

我对date_parse_from_format()方法有疑问:$parsed=date_parse_from_format("YdMH:iT",'201228Nov21:00CET');Returnsassociativearraywithdetailedinfoaboutgivendate.这将返回一个包含一些日期信息的数组。但是有什么方法可以将它转换为unix时间戳吗? 最佳答案 约翰,下面是如何在您的场景中实现mktime的具体示例:$parsed=date_parse_from_format("YdMH:iT",'2012

php - 如何在 PHP 的 require_once 中指定文件系统绝对路径?

简单地说,如何在PHP中使用require_once关键字指定绝对文件系统路径?该代码将在CLI中运行,而不是在网页上运行。根文件路径是什么?我正在运行Windows,仅供引用。谢谢。 最佳答案 尝试使用MagicConstant__DIR____DIR__Thedirectoryofthefile.Ifusedinsideaninclude,thedirectoryoftheincludedfileisreturned.Thisisequivalenttodirname(__FILE__).Thisdirectorynamedoe

php - parse_url() 在传递 example.com 时返回错误

根据以下代码,如果$host_name类似于example.comPHP返回通知:Message:Undefinedindex:host但在完整的URL,如http://example.comPHP返回example.com。我尝试了带有FALSE和NULL的if语句,但没有成功。$host_name=$this->input->post('host_name');$parse=parse_url($host_name);$parse_url=$parse['host'];如何修改脚本以接受example.com并返回它? 最佳答案

PHP "parse error, expecting ` T_STRING' "- 请帮忙提供代码

我正在尝试使用MVC原则构建动态php站点。我在WinXP上使用WAMP。代码如下:索引.php:标题.php:'?>页脚.php:用户.php:userName;}}?>此代码在User.php的第9行(即get函数声明处)导致php错误。错误信息是:Parseerror:parseerror,expecting`T_STRING'inC:\wamp\www\Projet\User.phponline9非常感谢您的帮助....谢谢,JDelage 最佳答案 function$getUserName()应该是functiongetU

php - WooCommerce 编辑帐户抛出 'display name is a required field' 错误

我在使用WooCommerce编辑帐户页面时遇到问题。提交表单时,显示错误消息“显示名称是必填字段”。我尝试同时添加一个字段inputtype="text"和display_name);?>但尝试添加该字段时运气不佳。我也尝试过使该字段不需要,但我不确定如何使用最新版本的WooCommerce来完成这些操作。 最佳答案 要使其不需要,请使用:add_filter('woocommerce_save_account_details_required_fields','wc_save_account_details_required_f

php - Zend 框架 : Require one out of three values

对于我的学校项目,我正在开发一个数据库管理应用程序。这是我的第一个真正的ZendFramework应用程序。现在,现在,我已经根据需要设置了3个值,邮政编码、电子邮件和电话。他们需要像这样(示例):$mail=$this->createElement('text','mail');$mail->setLabel('E-mail:')->setAttrib('size',50)->addValidator('StringLength',false,array(6,40))->addValidator('EmailAddress',true)->setRequired(true);$tel

php - 在我的 MVC 框架中解析错误 : parse error, 期望 `T_FUNCTION'

这个问题不太可能帮助任何future的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visitthehelpcenter.关闭9年前。我正在关注CreateyourFirstTinyMVCBoilerplatewithPHP教程,据我所知——我的代码与Jeff的代码相同……但我收到此错误:Parseerror:parseerror,expecting`T_FUNCTION'inD:\wamp\www\MVC_test\application\load.phponline8load.php

php - 如何捕获 require_once/include_once 异常?

我正在尝试编写类似这样的代码:getMessage();echo"Aerrorocurredwhentryingtoinclude'$include'.Errormessage:$message";}}我已经尝试了require_once和include_once,但是trycatch没有捕捉到异常。我怎样才能捕捉到这个fatalerror/警告异常? 最佳答案 由于include/require不会抛出异常,因此请先检查您要包含的文件是否存在且可读。例如:$inc='path/to/my/include/file.php';if(

PHP - 具有相对路径的 include() 或 require() 在 Windows 上不起作用,即使在附加 __DIR__ 时也是如此

我在这里读到有关在将include()或required()与相对路径一起使用时PHP中出现的问题,我看到的所有解决方案都是附加DIR我目前在Windows上工作,尽管错误消息显示了DIR的当前值,但相对路径似乎是作为字符串添加的,而不是向上一级,例如:include(__DIR__."..\\another_folder\\file_2.php");产生以下错误:警告:包括(C:\xampp\htdocs\main_folder..\another_folder\file_2.php)[function.include]:无法打开流:在中没有这样的文件或目录知道发生了什么吗?

PHP fatal error : require_once(): Failed opening required 'Zend/Gdata/Extension.php'

由于某些奇怪的原因,我现在无法弄清楚,NoEmbed.php在尝试包含文件时失败并出现fatalerror。包含路径设置正确,我已经验证如下(就在NoEmbed.php中的require_once指令之前):$s=ini_get('include_path');$a=explode(':',$s);foreach($aAS$path){echo$path;if(file_exists($path.'/Zend/Gdata/Extension.php'))echo'...found';elseecho'...notfound';}在预期位置输出“found”。我必须承认,我目前无法想出发