草庐IT

饭碗警告

全部标签

php - 如何获取 file_get_contents() 警告而不是 PHP 错误?

file_get_contents('https://invalid-certificate.com');产生以下PHP警告和错误:PHPwarning:PeercertificateCN='*.invalid-certificate.net'didnotmatchexpectedCN='invalid-certificate.com'PHPerror:file_get_contents(https://invalid-certificate.com):failedtoopenstream:operationfailed我想使用异常而不是PHP警告,所以:$response=@file

php - 当模式无效时,如何禁用 DOMDocument::schemaValidate() 产生的警告?

为了避免模式验证过程中的PHP警告,可以使用libxml_use_internal_errors(true);和libxml_get_errors()[0]->message;来“手动”管理最终的验证错误消息。这在XML与模式不匹配时有效,但当模式本身无效时仍会触发警告。libxml_use_internal_errors(true);已经在返回的错误数组中捕获了错误消息,这个警告对我来说似乎是多余的,有什么方法可以绕过/禁用这个特定的警告吗?我在严格模式下工作,所以我在警告触发时停止执行,并将错误记录在数据库中,问题是PHP警告太模糊了,所以我想绕过它来报告libxml错误一个单独的

php - 警告 : session_start(): Cannot send session cache limiter - headers already sent

我收到一个很常见的错误。Warning:session_start():Cannotsendsessioncookie-headersalreadysentby(outputstartedat/home/sabarspinmatic/public_html/testing/index.php:1)in/home/sabarspinmatic/public_html/testing/index.phponline1但奇怪的是我只有一个php文件,其中只有1行session_start()。PHP代码是:谁能知道我为什么会收到这个错误。我检查了源代码及其显示.我不知道为什么会显示这个标签。

php - 修复 InitRuntimeInterface 的 TWIG 弃用警告

我收到以下TWIG弃用警告:The"Symfony\Bridge\Twig\Extension\FormExtension"classimplements"Twig\Extension\InitRuntimeInterface"thatisdeprecatedsinceTwig2.7,toberemovedin3.0但是,我找不到任何关于要更改的内容。有人可以指出正确的方向来解决这个警告吗? 最佳答案 我有同样的错误,将twig从v2.7.2更新到v2.7.4修复了它。composer更新twig/twig

php - PHP 代码中的数百个通知和警告

我继承了一些遗留代码,如果我在其中打开:error_reporting(E_ALL);我在我们的网站上收到了数百条消息,它们都像:Warning:include_once()[function.include]:Failedopening'../inc/variables.php'forinclusion(include_path='.:/usr/local/lib/php')in/var/www/html/xyz/xyz/xyz/payment.class.phponline9Notice:Undefinedindex:validateArrayNamein/var/www/html

php - 向数组添加新索引而不生成 'undefined index' 警告

我正在遍历一个数组,如果我在数组中发现错误,我会添加一个名为error的键。但是我收到一大堆“未定义索引”错误警告。如何在不产生这些警告的情况下执行此操作?请求的代码$csv=array();if(($handle=fopen($filePath,"r"))!==FALSE){while(($csv[]=fgetcsv($handle))!==FALSE);fclose($handle);}foreach($csvas&$row){if(count($row)>$maxCols)$maxCols=count($row);if(count($row)==0){$errors++;$row

php - mysqli_query() 警告参数 1 为 mysqli,给定为空。数据库查询失败

我收到这个警告:(!)Warning:mysqli_query()expectsparameter1tobemysqli,nullgiveninC:\wamp\www\inc\functions.phponline73CallStack#TimeMemoryFunctionLocation10.0003251048{main}()..\manage_user.php:020.0012295000find_all_users()..\manage_user.php:830.0012295376mysqli_query()..\functions.php:73Databasequeryfa

php - 警告 : Missing argument 1 when passing parameters from url to controller (laravel)

我正在构建这个网站,我想将url参数传递给路由以及从路由传递给Controller​​,我已经搜索了文档和谷歌,但找不到解决我的问题的方法这是一个示例urllocations/search?q=parameter1我现在的路线是这样的:Route::group(array('prefix'=>'search'),function(){Route::get('locations/{src?}','SearchController@locations',function($src=null){});});我的Controller看起来像这样:classSearchControllerext

PHP:双重输出 php 错误/警告/通知

如果我执行以下脚本:我得到以下输出:Notice:testnoticeinpath/to/script/test.phponline3endofscriptPHPNotice:testnoticeinpath/to/script/test.phponline3脚本在IIS8上执行,PHP版本为5.4.19。返回的http状态码为200。在php.ini文件中,“display_errors”设置为“On”,“error_reporting”设置为“E_ALL”。所以脚本的第一行只是为了说明。行为与所有错误报告常量(E_ERROR、E_WARNING等)相同。有谁知道通知的第二个输出是从

php - Laravel npm install 收到警告 - npm WARN deprecated graceful-fs

我是Laravel的新手,所以我需要一些帮助。我正在接受来自Laracasts的培训howtomanagecssandjs.当我尝试运行npminstall时,我收到一些警告,例如npmWARNinstall无法安装可选依赖项:不支持我也尝试使用npminstall--globalgulp安装gulp,但我明白了npmWARNdeprecatedgraceful-fs@3.0.8:graceful-fsv3.0.0andbeforewillfailonnodereleases>=v7.0.Pleaseupdatetograceful-fs@^4.0.0assoonaspossible.