草庐IT

match_content

全部标签

php - 正则表达式(php 中的 preg_match): last groups in the output array don't work correctly

使用这种模式:(howis\s)?(the\s)?(weather)\s?((on)\s)?(today|tomorrow|sunday|monday|tuesday|wednesday|thursday|friday|saturday|sunday|thisweek)?(\s(in)\s(.*)\s?(on)?\s?(today|tomorrow|sunday|monday|tuesday|wednesday|thursday|friday|saturday|sunday|thisweek)?)?这就是我要捕捉的东西输入:维也纳星期二的天气怎么样输出:array(100=>howis

来自 Array with Multine 的 PHP 正则表达式 preg_match 不匹配所有 block

想知道是否有人可以帮助我使用以下正则表达式,我无法匹配blockmultineCF.{CoordonneesAbonne}:在PHP的preg_match函数中使用时。奇怪的是,当我在线执行正则表达式时,尽管该block在另一个组中,它似乎仍然有效regex101example这是代码:sourcecode'CF.{Temps}:1',2=>'CF.{Etat}:return',3=>'CF.{Code}:2',4=>'CF.{Values}:plaque',5=>'',6=>'CF.{Coordonnees}:LAPERSONNE',7=>'',8=>'10000LAVILLE',9

php - 使用自签名证书的 MAMP 中的 file_get_contents 失败

我使用file_get_contents()在我的站点中包含svg文件。通常这在http上工作正常,但我将此站点设置为在本地使用https。当我这样做时,出现此错误:Warning:file_get_contents():SSLoperationfailedwithcode1.OpenSSLErrormessages:error:14090086:SSLroutines:ssl3_get_server_certificate:certificateverifyfailedonline226Warning:file_get_contents():Failedtoenablecryptoo

php file_get_contents 向 Bugzilla 安装发送错误的内容类型

我正在创建一个脚本,该脚本应向bugzilla安装发送请求,以便登录用户并发布错误。我正在使用Google代码上提供的BugzillaPHPhttp://code.google.com/p/bugzillaphp/在我的本地服务器上一切正常,但在应该运行脚本的远程服务器上却不行。我从Bugzilla返回的错误是:Content-Typemustbe'text/xml,''multipart/*,''application/soap+xml,''or'application/dime'insteadof'application/x-www-form-urlencoded'这意味着我的脚本

php - 如何获取媒体 :content with SimpleXML

这个问题在这里已经有了答案:Reference-HowdoIhandleNamespaces(TagsandAttributeswithaColonintheirName)inSimpleXML?(2个答案)关闭2年前。我有一个XML提要,可以在新闻网站上获取有关塞浦路斯的新闻。我想使用新闻图片,当然还有新闻本身。这是一个xml示例RumlardanKKTCüniversitelerineambargoKıbrısRumyönetimi,KKTC'dekiüniversitelerleişbirliğiyapanülkelerineğitimkurumlarınaresmiyazıla

php - preg_match_all( ) 在不同的服务器上表现不同

下面的代码在我的PC上的XAMPP上运行完美,但在我新买的VPS上不起作用。它使我的代码崩溃。preg_match_all("/$regex/siU",$string,$matches,PREG_SET_ORDER);这应该只是从HTML中获取链接和标题。以前,今天也出现过类似的正则表达式问题。代码在本地服务器上运行良好,但在vps上创建“连接已重置”错误。该问题是由一些注释的html(其中包含php代码)引起的,使用以下代码将其删除以优化输出,但即使连接重置的问题已解决,HTML在浏览器源代码中仍然有注释。$string=preg_replace('//','',$string);那

php - 正则表达式帮助 : how to match only either pattern in a regex that contains "or" operator?

我正在使用php的preg_replace().基本上我有2种可能的字符串匹配:你好现实世界问候这是我希望完成的:HelloRealWorldGreetings规则解释:如果字符串包含空格,插入在第一个空格字符之后。如果字符串不包含空格(一个单词),则插入就在字符串的中间(+/-如果奇数字符计数)。到目前为止,我已经想出了一个长期有效的解决方案:",$str,1):preg_replace("/.{".round(strlen($str)/2)."}/","$0",$str,1);?>但是,我相信它可以通过一个更短、更优雅的正则表达式来完成,只有一个preg_replace()。打电话

php - 如果...否则发出 : removing the matched variable

我是编码新手,无法建立简单逻辑的想法..好的,我写了一个代码先看看:$mnaTotalCharectars:$c_mna";}$go[0]="January";$go[1]="February";$go[2]="March";$go[3]="April";$go[4]="May";$go[5]="June";$go[6]="July";$go[7]="August";$go[8]="September";$go[9]="October";$go[10]="November";$go[11]="December";$fo="October";$i=0;for($i=0;$i我想做的是删除

php - preg_replace file_get_contents 中不包含单词的所有链接

这个问题在这里已经有了答案:Regularexpressiontomatchalinethatdoesn'tcontainaword(33个答案)关闭9年前。我正在将一个页面读入一个变量,我想禁用地址中不包含单词“remedy”的所有链接。到目前为止,我的代码获取了所有链接,包括带有“补救措施”的链接。我做错了什么?$page=preg_replace('~(.*?)~i','$1',$page);--解决方案--$page=preg_replace('~(.*?)~i','$2',$page);

php - Doctrine DQL 无效参数编号 : number of bound variables does not match number of tokens

我在这个查询中收到错误无效的参数编号:绑定(bind)变量的数量与标记的数量不匹配。我真的没有看到问题,有什么想法吗?publicfunctiongetByPartial($q,Company$company){$query=$this->createQueryBuilder('u')->join('u.company',':company')->where('u.firstNameLIKE:q')->orWhere('u.lastNameLIKE:q')->setParameters(array('company'=>$company,'q'=>'%'.$q.'%'))->getQu