草庐IT

no-match

全部标签

php - Symfony2 "Parameter ""for route ""must match "[^/]++"(""given) to generate a corresponding URL."

我有这个路线文件:indexRechercheZones:path:/gestionzonestechniquesdefaults:{_controller:MySpaceGestionEquipementsTechniquesBundle:GestionZonesTechniques:indexZonesTechnique}requirements:methods: GETmodifierZones:path:/gestionzonestechniques/modifier/{nom}defaults:{_controller:MySpaceGestionEquipementsTec

php - 压缩存档 PHP : Close() returns false with no error message

我正在尝试使用基于数组结构的目录树创建一个zip文件。我已经在使用thisanswer当我需要从目录树创建一个zip文件时,但在这种情况下,所有文件都在同一目录中,目录树基于数据库中的其他数据。我已经检查过所有文件都在正确的路径中,并且foreach循环正在运行。$zip->close发生错误。这就是代码(原始数组在每一层都有很多条目):$zip_array=array('Level1'=>array('Level2'=>array('file1'=>'/var/www/html/pdf/683026577.pdf','file2'=>'/var/www/html/pdf/683026

php - Laravel 5 错误 SQLSTATE[HY000] [1045] 拒绝用户 'forge' @'localhost' 访问(使用密码 : NO)

有时(大约每20个请求)我会收到此错误。但是下一个(下一秒),同样的请求,就可以了。我不知道为什么第一个失败了。有时我会得到另一个错误:Nosupportedencrypterfound.Thecipherand/orkeylengthareinvalid.我的.env数据库参数没有问题。我已经使用phpartisankey:generate生成了一个key此key在我的.env文件中的APP_KEYkey下我的config/app.php有一个key'key'=>env('APP_KEY'),'cipher'=>'AES-256-CBC'有人知道这是怎么发生的吗?

php - file_put_contents(.../bootstrap/cache/services.json) : failed to open stream: No such file or directory

我在运行任何phpartisan命令时一直收到此错误。[ErrorException]file_put_contents(/Applications/MAMP/htdocs/code/bheng/md-bheng/bootstrap/cache/services.json):failedtoopenstream:Nosuchfileordirectory我该如何阻止它? 最佳答案 编辑-如果services.json文件不存在,运行phpartisanserve然后停止强制创建文件。请参阅:laravelservices.jsonn

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

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

php - 这是 php 中的快速进程 strpos()/stripos() 或 preg_match()

我只想知道在php中,strpos()/stripos()或preg_match()函数中哪一个会更快。 最佳答案 我找到了thisblog已经对你的问题做了一些测试,结果是:strpos()比preg_match()快3-16倍stripos()比strpos()慢2-30倍stripos()比preg_match()快20-100%无大小写修饰符“//i”在preg_match()中使用正则表达式并不比使用正则表达式快长字符串在preg_match()中使用utf8修饰符“//u”使其慢2倍使用的代码是:

php - 请求。错误 : Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET/"

我已经安装了Symfony2,修复了文件权限后,我可以通过将浏览器指向以下地址来访问开发环境:http://localhost/app_dev.php但是,当我尝试通过将浏览器指向http://localhost来访问生产环境时,出现以下异常(来自app/logs/prod.log):[2012-08-1311:30:03]request.ERROR:Symfony\Component\HttpKernel\Exception\NotFoundHttpException:Noroutefoundfor"GET/"(uncaughtexception)at/path/to/framewo

PHP 数组 : summing values with matching dates

我正在尝试弄清楚如何对具有相似日期的多维数组的某些值求和。这是我的数组:2011,'month'=>5,'day'=>13,'value'=>2),array('year'=>2011,'month'=>5,'day'=>14,'value'=>5),array('year'=>2011,'month'=>5,'day'=>13,'value'=>1),array('year'=>2011,'month'=>5,'day'=>14,'value'=>9));?>这是我希望输出的样子:2011,'month'=>5,'day'=>13,'value'=>3//thesumof1+2),a

php - 尝试在 Preg_Match 中查找正斜杠

我已经搜索了几个小时,试图找到解决这个问题的方法。我正在尝试确定REQUESTURI是否合法并从那里分解它。$samplerequesturi="/variable/12345678910";判断是否合法,第一段variable只有字母,长度可变。第二部分是数字,总共应该有11个。我的问题是转义正斜杠,以便它在uri中匹配。我试过:preg_match("/^[\/]{1}[a-z][\/]{1}[0-9]{11}+$/",$samplerequesturi)preg_match("/^[\\/]{1}[a-z][\\/]{1}[0-9]{11}+$/",$samplerequestu

PHP:Preg_match_all 将 html 提取到字符串中

我有这样的html:Tagged:sports,entertain,funny,comedy,automobile,moretags.如何将运动、娱乐、搞笑、喜剧、汽车提取到字符串中我的phppreg_match_all看起来像这样:preg_match_all('/(.*?),/',$this->page,$matches);echovar_dump($matches);echoimplode('',$tags);它不起作用。 最佳答案 我不确定您是如何从中获取$this->page的,但是以下内容应该会如您所料:http://i