草庐IT

input-datetime

全部标签

php - 在 Laravel 4 中返回 Input::except() 多个输入

我正在使用Laravel4,我正在使用验证器验证表单:$validator=Validator::make(Input::all(),$rules);失败时:if($validator->fails()){returnRedirect::to('register/test')->withErrors($validator)->withInput(Input::except('password'));//sendbacktheinputsothatwecanrepopulatetheform}我怎样才能返回除了多个输入之外的输入,而不仅仅是密码?我试过Input::except('pas

php 101 DateTime 使用 atom 格式

我正在尝试使用DateTime类以DateTime::ATOM格式输出当前时间。我什至不确定我是否正确使用它。或者我是否必须导入一个库或者打开一个wampphp模块。我收到“语法错误,意外的T_NEW”错误代码如下:?> 最佳答案 您可以像这样使用DateTime:$time=newDateTime;echo$time->format(DateTime::ATOM);构造函数(newDateTime)需要您为其创建对象的时间,此时格式并不重要.您在输出时间时指定格式。话虽如此,您遇到的错误似乎无关紧要,可能与该特定行没有任何关系。

php - DateTime 修改当年第一天的字符串

我正在寻找一年中第一天(现在是2011年1月1日)的DateTime修改字符串。我尝试了以下方法:modify('firstdayofthismonth');echo$time->format('c')."\n";//thisdoesn'twork.Ialsotriedseveralotherways$time->modify('firstdayofjanuary');echo$time->format('c')."\n";>我知道还有其他方法可以检索日期,但我在字符串中搜索DateTime->modify()没有其他解决方案。 最佳答案

php - joomla 安装新语言 DateTime::__construct(): 解析时间字符串失败 (jerror)

我是全新安装的Joomla3.1,在我的家用电脑上运行。我的环境是带有apache服务器的Ubuntu12.10,安装了php5.4.6。自安装系统以来,不,我只是尝试通过语言管理器安装更多语言:如您所见,我想要的另外2种语言显示在列表中,但在选择每种语言并单击“安装”后,我被引导到一个包含以下消息的页面:DateTime::__construct():Failedtoparsetimestring(jerror)atposition0(j):Thetimezonecouldnotbefoundinthedatabase只需一个按钮即可返回到控制面板。看到这些语言出现在列表中,我感到很

php - 在 Laravel 4 中处理 Input::all() 中的复选框

我想用以下代码更新我的模型:$feature=Feature::find($id)->update(Input::all());这适用于除“完成”字段之外的所有字段,“完成”字段是表格中的bool值,在编辑表单中由复选框表示。{{Form::label('done','Done?')}}{{Form::checkbox('done',1)}}如何使用更新和Input:all()处理复选框?谢谢。 最佳答案 我找到了解决方法{{Form::hidden('done',0);}}{{Form::checkbox('done',1);}}

php DateTime createFromFormat 功能

您好,我似乎无法让日期时间方法按预期工作?我可能做错了什么?//PassesOK$dateTime=DateTime::createFromFormat('d/m/Y','12/12/2012');var_dump($dateTime);//shouldfailbutreturns-2016-09-25$dateTime=DateTime::createFromFormat('d/m/Y','56/56/2012');var_dump($dateTime);//correctlyreturnsFalse$dateTime=DateTime::createFromFormat('d/m/

php - IntlDateFormatter::format():datefmt_format:采用数组或整数时间戳值或 DateTime 对象 (SonataSanBox)

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭7年前。Improvethisquestion我已经安装了SonataAdminBundle。一切正常,但是当我从仪表板添加任何用户时,它会发出警告:Warning:IntlDateFormatter::format():datefmt_format:takeseitheranarrayoranin

php - PDO execute($input_parameter) 作为 bindParam/bindValue 保护免受 sql 注入(inject)?

execute($input_parameter)是否像bindParam/bindValue一样防止sql注入(inject)?如果答案是肯定的,bindParam()/bindValue()/execute()是否不受任何sql注入(inject)攻击?或者我需要采取措施防止此类攻击?感谢您的帮助! 最佳答案 就execute($input_parameters)与单独的bindParam/bindValue/execute步骤一样安全而言,答案基本上是肯定的。但是,您可能仍需要采取进一步的措施,具体取决于您构建传递给PDO::

php - 形成边界并写入 php ://input to a file in php

所以我希望用户能够上传大文件而不必担心帖子的最大大小值。另一种方法是使用PUT并将文件作为原始数据发送。使用jquery时,我可以这样做:vardata=newFormData();jQuery.each($('#file_upload')[0].files,function(i,file){data.append('file-'+i,file);});$.ajax({url:'upload.php?filename=test.pdf',data:data,cache:false,contentType:false,processData:false,type:'PUT',});在PH

PHP:比较两个具有不同时区的 DateTime 对象

PHP如何比较DateTime使用条件运算符时的对象(、>、>=、)?这个比较时区不变吗?我试过下面的代码,看起来它是时区不变的,有人可以确认吗?代码:$datestr="2015-10-0910:28:01";$dt=newDateTime($datestr);$nowdate=newDateTime("now",newDateTimeZone("CET"));print_r($dt);echo"";print_r($nowdate);echo"";var_dump($nowdate输出:DateTimeObject([date]=>2015-10-0910:28:01[timezo