草庐IT

time2string

全部标签

php - 如何通过 PHP 和 String 函数获取所有 TD 值

这个问题在这里已经有了答案:ExtractdatafromHTMLtablerowcolumn(3个答案)关闭2年前。我需要从TD获取数据,变量是一个字符串:$string='abcdefghi';echo$td_num=substr_count($string,'');for($i=0;$i".$i."";$first_td[$i]=strpos($string,'');echo'Firstposition:'.$first_td[$i]."";$last_td[$i]=strpos($string,"");echo'Lastposition:'.$last_td[$i]."";$t

php - PHP 中的正则表达式 : find the first matching string

我想在非常非常长的文本中找到第一个匹配的字符串。我知道我可以使用preg_grep()并获取返回数组的第一个元素。但是如果我只需要第一场比赛(或者我知道提前只有一场比赛),这样做效率不高。有什么建议吗? 最佳答案 preg_match()?preg_match()returnsthenumberoftimespatternmatches.Thatwillbeeither0times(nomatch)or1timebecausepreg_match()willstopsearchingafterthefirstmatch.preg_m

PHP 执行时间超过 max_execution_time... 有时

我有一个PHP类,调用后将时间限制设置为60秒。这个类唯一的特别之处在于它使用了curl_multi_exec()。set_time_limit(60);ini_set('max_execution_time',60);问题是在Apache的/server-status页面下,这个页面和另一个使用单线程curl的页面有时会超过它们的max_execution_time并达到200秒!我错过了什么?有没有办法设置Apache终止运行时间超过90秒的脚本(甚至连接)? 最佳答案 来自themanual:Theset_time_limit

php - 绕过 max_execution_time?

我的服务器上有10秒,这对我想要做的事情来说还不够。它也被网络托管商禁用了。如果在执行了一定时间后,我执行了一个单独的PHP页面,这算在同一时间还是在该页面上重新开始?还有别的办法吗? 最佳答案 绕过最大执行时间的简单方法是像这样设置时间限制:设置时间限制(0); 关于php-绕过max_execution_time?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/7318825

php - 如何调试 "Maximum execution time" fatal error ?

我正在尝试在我的应用程序中使用Zend_acl。我遵循了“ZendFrameworkinaction”一书。我添加了这个助手:_auth=Zend_Auth::getInstance();$this->_acl=$options['acl'];//var_dump($this->_acl);die();}publicfunctioninit(){$this->_action=$this->getActionController();//addresourceforthiscontroller$controller=$this->_action->getRequest()->getCon

php - 更改错误日志输出格式 : ini_set ('error_append_string' , 'string' ) 和 ini_set ('error_prepend_string' , 'string' ) 什么都不做

这是我告诉php要做的:希望我能在一个文件中报告所有错误,在消息前加上“PRE”,在消息后加上“APP”。(我的目标是把PRE和APP做成/n/r什么的。。。)但是我的报错日志是这样的:[14-May-201300:16:26]PHPNotice:Undefinedvariable:nonexistentvariablein/home/www/dir/index.phponline14[14-May-201300:16:28]PHPNotice:Undefinedvariable:nonexistentvariablein/home/www/dir/index.phponline14没

PHP PDO : Charset=UTF8 : An invalid keyword charset was specified in the dsn string

我正在使用sqlsrv驱动程序连接到带有PDO的MSSQL服务器。PHP版本为5.3.24。工作连接如下所示:$dsny="sqlsrv:Server=xx1;Database=xx2";$usery='xx3';$passwordy='xx4';$dbhy=newPDO($dsny,$usery,$passwordy);**但是我需要设置字符,然后我试试这个:$dsny="sqlsrv:Server=xx1;Database=xx2;charset=utf8";$usery='xx3';$passwordy='xx4';$dbhy=newPDO($dsny,$usery,$passw

php - 可捕获的 fatal error : Object of class PDOStatement could not be converted to string in line 114

这个问题在这里已经有了答案:returnonevaluefromdatabasewithmysqlphppdo(3个答案)关闭23天前。我正在尝试向我的数据库中添加一些数据,但我在第114行的/var/www/mandje.php中收到错误Catchablefatalerror:ObjectofclassPDOStatementcouldnotbeconvertedtostringin/var/www/mandje.php。这是我正在使用的代码:foreach($_SESSION["cart"]as$id=>$value){$query=$db->query('SELECT*FROMP

php - PHP 在启动过程的什么时候设置 REQUEST_TIME 变量

如PHPdocumentation中所述,$_SERVER超全局数组包含两个元素,REQUEST_TIME和REQUEST_TIME_FLOAT,它们都包含请求开始的时间戳,在不同的精度水平。我目前正在使用以下代码段来包含服务器在页面页脚中生成页面所花费的时间(以毫秒为单位):round((microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'])*1000,2);它返回一个准确的值(无法真正检查,但它似乎与浏览器开始加载页面所需的时间相匹配),但我想知道$_SERVER['REQUEST_TIME']和$_SERVER['REQUEST_TIME_

php - 通知消息 : Array to string conversion

我是codeigniter和php的初学者,我正面临这个问题APHPErrorwasencounteredSeverity:NoticeMessage:Undefinedvariable:queryFilename:inc/header_main_view.phpLineNumber:175APHPErrorwasencounteredView:id_task;?>name;?>20%20%Completeindex.php/dashboard/g_tasks_menu">ViewalltasksControllerpublicfunctionget_todo($id=null){$t