草庐IT

not_matched

全部标签

php - 正则表达式 : Match 1 to 60 or all

我需要一些关于php(Symfony)中的正则表达式的帮助。我想匹配值1到60或全部字符串。对于数字,我使用了这个:^([1-5]?[0-9]|60)但它匹配0...而我不要现在怎么能匹配“全部”。你能帮帮我吗?非常感谢之前 最佳答案 您应该能够将其分为以下几种可能性:^([1-9]|[1-5][0-9]|60|all)$这给了你四种可能性:[1-9]个位数的值。[1-5][0-9]:从十到五十九的所有内容。60:六十。all:您的“全部”选项。但请记住,正则表达式并不总是所有问题的答案。有时它们对于复杂的值检查不太有用(尽管在这种

php - 发生客户端错误 : Could not create storage directory:/tmp/Google_Client/00

此错误对YoutubeAPIv3.0意味着什么:Aclienterroroccurred:Couldnotcreatestoragedirectory:/tmp/Google_Client/00我在Google的文档中使用PHPYoutubeAPI找到here. 最佳答案 我在不更改GoogleAPI的任何行的情况下解决了这个问题。在您的PHP代码中,您只需要指定缓存文件夹所在的位置:$config=newGoogle_Config();$config->setClassConfig('Google_Cache_File',arra

php - Symfony 2.7 : default timezone not set, 导致 fatal error

我正在尝试在共享服务器上设置一个基于symfony2.7的应用程序,并且没有权限更改php.ini.执行:phpapp/consoledoctrine:schema:drop--force输出此警告/错误:PHPWarning:Uncaughtexception'Symfony\Component\Debug\Exception\ContextErrorException'withmessage'Warning:date_default_timezone_get():Itisnotsafetorelyonthesystem'stimezonesettings.Youare*requir

php - Zend_Controller_Router_Exception : "xyz" is not specified

我当前的ZendFramework应用程序有问题。在我的Bootstrap中,我注册了这些路由:protectedfunction_initRouter(){$this->bootstrap("FrontController");$frontController=$this->getResource("FrontController");$route=newZend_Controller_Router_Route(":module/:id",array("controller"=>"index","action"=>"index"),array("id"=>"\d+"));$front

php - 将 preg_match() 与 REGEX 表达式一起使用时的未知修饰符 '('

这个问题在这里已经有了答案:Warning:preg_replace():Unknownmodifier(3个答案)关闭3年前。我正在尝试使用preg_match()通过PHP验证诸如DD/MM/YYYY之类的日期。这是我的REGEX表达式的样子:$pattern="/^([123]0|[012][1-9]|31)/(0[1-9]|1[012])/(19[0-9]{2}|2[0-9]{3})$/";但是用正确的值使用它,我得到这个消息:preg_match():Unknownmodifier'('完整代码:$pattern="/^([123]0|[012][1-9]|31)/(0[1-

php - 如何转义 preg_match 模式中的斜杠字符?

这个问题在这里已经有了答案:IsthereaPHPfunctionthatcanescaperegexpatternsbeforetheyareapplied?(2个答案)关闭4年前。我有这样一段文字:line1/1/1/2行短语之后的文本是函数的参数,例如当我调用extractData('1/1/1/2','Themaintext')时:functionextractData($line,$text){$pattern="/line(\s+)$line/";if(preg_match($pattern,$text)){//somecode}}如何转义模式中的斜杠字符?换句话说,我应该

php - 我在 Ubuntu 14.04 中使用 codeigniter 得到 URL not found 问题错误

我已将我的codeigniter项目与Ubuntu14.04集成。在默认Controller(即登录Controller)之后,它给我urlnotfound错误。请找到以下.htaccess文件RewriteEngineOnRewriteBase/myapp/#Removesaccesstothesystemfolderbyusers.#AdditionallythiswillallowyoutocreateaSystem.phpcontroller,#previouslythiswouldnothavebeenpossible.#'system'canbereplacedifyouh

php - 在 Laravel Forge 上部署抛出 faker not found Exception

我正在尝试在forge上部署一个laravel项目,但出现以下异常:Symfony\Component\Debug\Exception\FatalErrorException]Class'Faker\Factory'notfound我在composer.json的require-dev中有faker引用!composer.json文件{"name":"laravel/laravel","description":"TheLaravelFramework.","keywords":["framework","laravel"],"license":"MIT","type":"projec

php - 使用 preg_match 查找所有 PHP 变量

如何使用preg_match找到所有PHP变量。我制作了以下正则表达式:$string='Hallo$var.blabla$var,$iamavar$varvarvargfgdjfjdfgjhfd$variable';$instring=array();preg_match_all('/\$(.*?)/',$string,$instring);print_r($instring);我只是不明白正则表达式是如何工作的。 最佳答案 \$(.*?)不是匹配PHP变量名的正确正则表达式。这样的aregularexpressionforaVa

php - Laravel PHP fatal error : Class 'Table' not found with migrate command

我正在使用Laravel,我正在尝试将一些表迁移到我的数据库(phpmyadmin)。之前给我带来了一些麻烦,所以我在数据库中删除了迁移表中的所有行,所以现在什么都没有了。所以我尝试运行“phpartisanmigrate”,但出现以下错误:PHPFatalerror:Class'Table'notfoundin/var/www/loja/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.phponline301{"error":{"type":"Symfony\Component\Debug\Ex