草庐IT

last_modified

全部标签

php - error_get_last() 和自定义错误处理程序

odbc_errormsg不报告来自odbc_execute的错误消息它应该的方式。它只是发出警告。所以我被迫编写一个hack来通过error_get_last解析错误消息.我正在使用set_error_handler并且error_get_last返回NULL除非我:禁用我的错误处理程序,或者让它返回FALSE。我想这是由于PHP的内置错误处理程序负责将错误详细信息存储在某个地方,以便以后可以检索它们。有没有办法在我的自定义错误处理程序中模拟这种行为,以便error_get_last()可以正常使用?请注意,我已经知道几种随时检索错误信息的方法。我的问题是如何使error_get_l

PHP - 用于警告的 error_get_last 方法?

我正在使用unlink在我的PHP页面上。在某些情况下,删除目录的权限可能会被拒绝。而不是拥有警告:unlink(stuff/Newfolder)[function.unlink]:第30行...中的权限被拒绝出现在呈现的页面上,有没有办法让我做一个“warning_get_last”来捕获最后给定的警告,这样我就可以很好地输出它?还是error_get_last包括这些?我知道我可以用@unlink抑制警告,我也可以检查unlink是否返回false,但我想知道错误消息如果它确实失败了。 最佳答案 使用error_reportin

php - preg_match_all() [function.preg-match-all] : Unknown modifier ']'

使用了几种不同的模式,但它们都出现了这个错误-那是怎么回事?我最短的诊断是:$pattern="]*[^/])>";preg_match_all($pattern,$subject,$matches);谢谢 最佳答案 您缺少正则表达式分隔符。尝试:$pattern="#]*[^/])>#i"; 关于php-preg_match_all()[function.preg-match-all]:Unknownmodifier']',我们在StackOverflow上找到一个类似的问题:

php - PHP 中的 HTTP if-none-match 和 if-modified-since 以及 304 说明

我的问题是关于当我从代理/客户端请求同时if-none-match和if-modified-since时如何回复HTTP304“未修改”。来自RFC2616第14.26节(http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26):Ifnoneoftheentitytagsmatch,thentheserverMAYperformtherequestedmethodasiftheIf-None-Matchheaderfielddidnotexist,butMUSTalsoignoreanyIf-Modified-Si

php - 弃用 : preg_replace(): The/e modifier is deprecated, 改用 preg_replace_callback

我需要一点帮助。因为preg_replace已弃用,我必须将所有mypreg_replace转换为preg_replace_callback...我尝试过的:改变:$template=preg_replace("#\\[aviable=(.+?)\\](.*?)\\[/aviable\\]#ies","\$this->check_module('\\1','\\2')",$template);收件人:$template=preg_replace_callback("#\\[aviable=(.+?)\\](.*?)\\[/aviable\\]#isu",return$this->che

php - 关于错误 "Attempt to modify property of non-object"

谁能告诉我为什么下面的代码会有不同的结果?取消设置对象属性$s=newStdClass;unset($s->a->b);//itisworkingfineunset($s->x->y->z);//itisgotanerror:Attempttomodifypropertyofnon-object取消数组索引$a=array();unset($a[1][2]);//itisworkingfineunset($a[3][4][5]);//itisworkingfine 最佳答案 标准类与数组数组PHP中的数组允许从基数隐式创建多维数组。

php - preg_replace : bad regex == 'Unknown Modifier' ?

我正在编造假的电子邮件地址,我只是想确保它们采用有效的电子邮件格式,所以我试图删除不在以下集合中的任何字符:$jusr['email']=preg_replace('/[^a-zA-Z0-9.-_@]/g','',$jusr['email']);我在我的windows机器上没有遇到任何问题,但是在linux开发服务器上我每次运行这段代码时都会收到这个错误:Warning:preg_replace()[function.preg-replace]:Unknownmodifier'g'in/var/www/vhosts/....我认为这是正则表达式字符串,但我无法确定。帮助不大?谢谢。澄清

php - "function modifies argument passed by reference"是否有 PHP Doc 语法?

在为函数编写PHP文档时,如果函数返回一个值,您将编写如下内容@returnarray$someArray格式化日期数组但假设我的函数不返回值,而是修改作为引用传递的原始值,例如:functionformatDates(&$input_arr){/***Formatsanarrayofdates*@paramarray$input_arrAnarrayofrawdates*/array_walk_recursive($input_arr,'formatDateFunction');}此函数修改输入数组。我知道参数前面的&很明显,但是返回值也很明显,return也很明显,所以我觉得可能有

php - strtotime ('first day of last month' 的版本差异)?

在包含的脚本中date('Y-m-d',strtotime('firstdayoflastmonth'))例如,在版本5.3.10(本地主机)中,我得到“2012-03-01”。在版本5.2.17(远程主机)中,我得到“1969-12-31”。是否有一个表达式会返回两个版本的预期(例如,“2012-03-01”)结果? 最佳答案 你应该使用mktime()功能:SeeInAction 关于php-strtotime('firstdayoflastmonth'的版本差异)?,我们在Stac

php - 为什么我在 codeigniter 中收到 "cannot modify header information headers already sent by registration_model"错误?

这个问题在这里已经有了答案:Howtofix"Headersalreadysent"errorinPHP(11个答案)关闭9年前。我的codeigniter应用程序中的模型有问题。我收到发送header信息的错误。基本上,codeigniter提示我的注册模型先发送header信息。这怎么可能?我认为模型仅用于保存数据库查询方法,仅此而已。有人可以解释一下吗?Controller的开头是这样的:functionUser(){parent::Controller();$this->view_data['base_url']=base_url();$this->load->model('U