草庐IT

var_available_in_function

全部标签

php - 拉维尔 5.2 : Creating a custom route function - extending route

基本上,我想创建自己的Route::custom函数。这是因为我一直在为整个站点的多个路由使用相同的组和中间件(我还使用带有子域的模块,所以我们正在谈论为每个路由节省5-6行代码)我只想让Route::custom调用两个或三个其他Route函数。例如:Route::Module('forum')替换为Route::group(['middleware'=>['web','auth'],'domain'=>'forum.'.env('SITE_DOMAIN','example.com')],function(){Route::group(['middleware'=>'permissi

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

php - Laravel 5.2 curl_init() 抛出错误 "Call to undefined function"

我正在尝试使用curl在laravel中使用FCM,但出现错误。首先,我在我的一个Controller中编写了一个php代码:$first_name=$request->input('first_name');//FCMapiURL$url='https://fcm.googleapis.com/fcm/send';//api_keyavailableinFirebaseConsole->ProjectSettings->CLOUDMESSAGING->Serverkey$server_key='AIzaSyA1RyuAGGPASh_flFCwiyd9ZHEMYlhQOho';$tar

php - 无法打开流 : Permission denied in Laravel 5. 4 即使 Al 文件权限也被授予使用 Laravel 5.4 中的存储功能的路径

我正在尝试将文件上传到Laravel5.4中的C:\Users\sandeep\maxo\storage\app\public文件夹。我正在使用下面的代码{{csrf_field()}}ImportCSVorExcelFile$path=$request->file('import_file')->store('public');是laravel代码。但是我遇到这样的错误fopen(C:\Users\sandeep\maxo\storage\app\public/K4oIHMXveyx2VChmAXAcNkTmoIXKACvqoIbbHCeB.):failedtoopenstream:

php - Laravel 和 Eclipse : How to avoid errors in default code of Laravel 5. 5?

我在Laravel中创建了一个新项目,并使用EclipseIDE(适用于PHP)将其打开,但Laravel为路由生成的默认代码出现错误。我怎样才能防止这种情况发生?我只创建了项目并用Eclipse打开了它,但出现了该错误。 最佳答案 在文件顶部导入Route门面,如Request。useIlluminate\Support\Facades\Route;我推荐使用这个包,barrydvh/ide-helper,在你的项目中。它会生成Laravel外观和其他静态方法的映射,而IDE在开箱即用时会遇到问题。您还需要安装EclipsePHP

PHP 启动 : Unable to load dynamic library 'openssl' in Ubuntu

我在问题的标题中收到了错误消息,或者确切地说,我收到了这条消息PHPStartup:Unabletoloaddynamiclibrary'openssl'(tried:/usr/lib/php/20170718/openssl(/usr/lib/php/20170718/openssl:cannotopensharedobjectfile:Nosuchfileordirectory),/usr/lib/php/20170718/openssl.so(/usr/lib/php/20170718/openssl.so:cannotopensharedobjectfile:Nosuchfil

php - php错误日志中的 'in Unknown on line 0'是什么

我在我的php-fpm错误日志中收到多个警告,如下所示:PHPWarning:Unknown:failedtoopenstream:NosuchfileordirectoryinUnknownonline0PHPWarning:Unknown:Inputvariablesexceeded1000.Toincreasethelimitchangemax_input_varsinphp.ini.inUnknownonline0PHPWarning:Missingboundaryinmultipart/form-dataPOSTdatainUnknownonline0我尝试用google搜索

用于 url 验证的 PHP 正则表达式,filter_var 过于宽松

首先让我们根据我的要求定义一个“URL”。唯一允许的可选协议(protocol)是http://和https://然后是强制性域名,例如stackoverflow.com然后可选择其余的url组件(path、query、hash、...)根据我的要求引用有效和无效网址的列表有效stackoverflow.comstackoverflow.com/questions/askhttps://stackoverflow.com/questions/askhttp://www.amazon.com/Computers-Internet-Books/b/ref=bhp_bb0309A_comin

PHP 的 filter_var,它是一个很好的现代解决方案吗?

filter_var()的可靠性如何?你觉得有用吗?它是验证用户输入的好解决方案吗? 最佳答案 虽然我还没有在任何项目中使用过它,但我已经尝试了一下,我尝试过的所有过滤器似乎都工作得很好——而且它比我目前使用的凌乱的正则表达式更优雅的解决方案采用。我当然认为这是一个非常有用的功能,我将来肯定会使用它。 关于PHP的filter_var,它是一个很好的现代解决方案吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverfl

如果在函数调用中分配了 var,PHP 将忽略通过引用传递

我有两个功能functionc(&$x){$x=25;echo'ciscalled,x='.$x.PHP_EOL;}functionb(){echo'biscalled'.PHP_EOL;return5;}然后我编写了下面的代码,正如我所期望的那样,它应该将b()的结果放入$o,然后通过引用将$o传递给c()并将其设置为新值。它工作正常:$o=b();c($o);echo'ois'.$o;输出符合预期:biscalledciscalled,x=25ois25但是如果我尝试在这样的函数调用中分配$o的值:c($o=b());echo'ois'.$o;我得到奇怪的输出biscalledci