草庐IT

undefined-reference

全部标签

php - 通知 : Undefined index: HTTP_X_FORWARDED_FOR Error in Function

我收到通知:未定义索引:以下函数中的HTTP_X_FORWARDED_FOR:function_ip(){return(preg_match("/^([d]{1,3}).([d]{1,3}).([d]{1,3}).([d]{1,3})$/",$_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR']);} 最佳答案 您应该使用getenv()方法而不是$_SERVER。function_ip(){if(preg_

php - 为什么我在 PHP 中使用 cookie 时得到 undefined index ?

如果我使用下面的基本代码if(!defined('NAME_COOKIE'))define('NAME_COOKIE',"storedusername");$cookie_domain=".".$_SERVER['HTTP_HOST'];setcookie(NAME_COOKIE,$username,time()+(86400),"/",$cookie_domain);print$_COOKIE[NAME_COOKIE];脚本在打印过程中因undefinedindex错误而终止。我做错了什么? 最佳答案 你的台词:setcookie

php - 通知 : Undefined index: XXX - Does it really matter?

自从我将错误报告级别更改为error_reporting(E_ALL|E_STRICT);我就遇到了这个错误。我可以使用isset()避免这个错误,但代码看起来太丑了!所以我的问题是:如果我回到正常的错误报告设置怎么办?知道某些东西还没有定义真的很重要吗?因为它可以正常工作而不会出现Notice错误。因为我有+10个输入并且我是这样得到它们的:$username=$_POST['username'];我还尝试在文件顶部使用它来预定义变量。$username=null;和$username=0;但它们不起作用。谢谢。 最佳答案 这很重

php - fatal error : Call to undefined function easter_date()

我正在尝试获取今年的easter_date。这是我的代码:当我执行代码时出现以下错误:fatalerror:在中调用未定义的函数easter_date()我的php版本是5.3.3。我正在使用Linux(Ubuntu)。您知道缺少什么吗? 最佳答案 如果您使用基于php:7.1的Dockerfile,您可以轻松安装calendar扩展:RUNdocker-php-ext-installcalendar&&docker-php-ext-configurecalendar 关于php-fat

php - 在处理可能 undefined variable 时,在 PHP 中使用引用赋值是不好的做法吗?

我一直在考虑使用引用赋值作为处理潜在undefinedvariable的捷径。换句话说,代替:$foo=isset($this->blah['something']['else'])?$this->blah['something']['else']:null;if(!is_null($foo)&&...){//dosomethingwith$foo}我可以这样做:$foo=&$this->blah['something']['else'];if(!is_null($foo)&&...){//dosomethingwith$foo}看起来更简单,对吧?由于PHP通过引用处理赋值的方式,我

php - 如何解决 "Circular reference detected for service"问题?

我正在尝试将我的存储库服务注入(inject)到EventListener中,但这导致我出现以下异常,根据我对Symfony2的基本知识,我不知道如何解决。异常(exception)是:ServiceCircularReferenceExceptioninbootstrap.php.cacheline2129:Circularreferencedetectedforservice"doctrine.orm.default_entity_manager",path:"doctrine.orm.default_entity_manager->doctrine.dbal.default_co

php - 使用 gzopen() : undefined function 时出现 fatal error

我想使用gzopen函数打开一个.gz文件,但出现了这个错误:Fatalerror:Calltoundefinedfunctiongzopen()这里是关于我的安装的一些细节:OS:Ubuntu10.04uptodateApacheversion:2.2.14PHP:5.2.10-2ubuntu6在phpinfo()的Zlib部分,我得到了这个:ZLibSupportenabledStreamWrappersupportcompress.zlib://StreamFiltersupportzlib.inflate,zlib.deflateCompiledVersion1.2.3.3Li

php - Laravel Blade View - undefined variable : errors

当访问我的laravel应用程序的登录页面时,我得到一个Undefinedvariable:errors(View:D:\PhpstormProjects\laravel\resources\views\login.blade.php)错误。根据http://laravel.com/docs/master/validation#error-messages-and-views,$errors应该总是自动设置:So,itisimportanttonotethatan$errorsvariablewillalwaysbeavailableinallofyourviews,oneveryre

php - 第一次尝试 Laravel undefined variable

今天早上发生在我身上最奇怪的错误之一当我第一次尝试打开模型的展示Blade时,我得到了这个Undefinedvariable:engs(View:C:\wamp64\www\Form\resources\views\dashboard\placeShow.blade.php)但是当我刷新页面或重新打开它时一切正常我的Controller:publicfunctionshowPlace($id){$place=Place::find($id);if(!$place->seen->contains(Auth::user()->id)){$place=$place->seen()->save

php - laravel undefined variable : user

作为序言,我已经完成了大部分与我的问题一致的答案,几乎我有一个undefinedvariable为用户。我希望能够在仪表板上显示注册用户,我之前使用过这段代码并且它有效但不适用于此应用程序。Undefinedvariable:user(View:/Applications/MAMP/htdocs/eli/resources/views/dashboard.blade.php)这是我的代码,UserController.phpnamespaceApp\Http\Controllers;useIlluminate\Http\Request;useIlluminate\Support\Fac