草庐IT

METHOD_NAME

全部标签

php - 错误的 DNS 设置,php_network_getaddresses : getaddrinfo failed Name or service not known, nslookup

问题原来是这样的:Warning:file_get_contents()[function.file-get-contents]:php_network_getaddresses:getaddrinfofailed:Nameorservicenotknownin/home///ppk_hotweb.class.phponline58我也使用了cURL,它只是返回null,仅此而已。(文件和cURL)都已启用。尝试了file_get_contents('google.com')并且成功了!为什么file_get_contents('domain.com.au')不起作用?所以我开始阅读相

php - $_SERVER ['SERVER_NAME' ] 有什么好的替代品吗?

我在PHPdocpages上阅读了以下评论:"BewarnedthatmostcontentsoftheServer-Array(even$_SERVER['SERVER_NAME'])areprovidedbytheclientandcanbemanipulated.TheycanalsobeusedforinjectionsandthusMUSTbecheckedandtreatedlikeanyotheruserinput."然后我在这里看到了一个话题onStackOverflowsayingthat$_SERVER['SERVER_NAME']ispartlyservercon

PHP 可搜索迭代器 : catch OutOfBoundsException or check valid() method?

所以我不确定这是否是PHP的错误设计,或者是否存在处理同一界面的不一致结果的可理解逻辑。SeekableIterator接口(interface)有两个方法(seek和valid),它们要么相互冲突,要么应该一致地工作,但我看到两者。接口(interface)文档说seek应该抛出类OutOfBoundsException的异常,但这似乎否定了valid的用处,除非更新迭代器位置(使valid在抛出异常(显然必须捕获)之前返回false)。三个测试例子例子1.实现SeekableIterator的自定义类,如文档中的示例所提供的:类(class):classMySeekableIter

php - parent::method() - 调用非静态方法

我不明白在PHP中调用父方法的概念。父方法不是静态的,但它是静态调用的-通常PHP会抛出错误/警告。问题是,这是PHP的怪癖,还是在OOP中应该如此?以php.net为例:\n";}}classBextendsA{functionexample(){echo"IamB::example()andprovideadditionalfunctionality.\n";parent::example();}}$b=newB;//ThiswillcallB::example(),whichwillinturncallA::example().$b->example();?>http://php

PHP:从父级调用静态方法时出现 "Call to undefined method"错误

如果两者都是静态的,从父类调用子类方法的正确方法是什么?当我使用静态类时它返回错误“调用未定义的方法A::multi()”,但是当我使用非静态方法时没有问题,例如://--------------STATIC------------------classA{publicstaticfunctioncalc($a,$b){returnself::multi($a,$b);}}classBextendsA{publicstaticfunctionmulti($a,$b){return$a*$b;}}echoB::calc(3,4);//ERROR!!//--------------NON-

PhpStorm:获取 "Methods with the same name as their class will not be constructors"的代码检查警告

好吧,我终于切换到PHP7。我的代码有点旧,会被翻新。一些问题是:classMagicClassfunctionMagicClass(){//etc}在执行过程中给出弃用警告:Deprecated:MethodswiththesamenameastheirclasswillnotbeconstructorsinafutureversionofPHP;MagicClasshasadeprecatedconstructorin这很好:classMagicClassfunction__construct(){//etc}如何让PhpStorm代码检查来警告我当前代码库中的此类错误?

php - 银条 3 : the method 'fortemplate' does not exist on 'File'

我正在为我的页面创建一个GridField,它与我的DataObjects有一个has_many关系,但是在添加数据并保存对象后它会中断CMS中的页面。搜索后我无法弄清楚原因或找不到任何答案。这是错误和我的代码:[UserError]UncaughtException:Object->__call():themethod'fortemplate'doesnotexiston'File'ProductPage.phpclassProductPageextendsPage{//Contactobject'sfieldspublicstatic$db=array('ProductPrice'

php - Nginx 为静态文件代理不正确的 fastcgi_script_name

server{listenloc.app:80;root/app/frontend/web;indexindex.php;location/{try_files$uri$uri//index.php$is_args$args;}location~^/admin{proxy_passhttp://127.0.0.1:81;}location~*\.php${#phpconf}}server{listen127.0.0.1:81;root/app/backend/web;indexindex.php;location/{try_files$uri$uri//index.php$is_arg

php - Laravel: Trait method guard 没有被应用,因为与 App\Http\Controllers\Auth\AuthController 上的其他 trait 方法有冲突

我正在更新到Laravel5.4并收到此错误消息:Traitmethodguardhasnotbeenapplied,becausetherearecollisionswithothertraitmethodsonApp\Http\Controllers\Auth\AuthController这是我的AuthController类。middleware($this->guestMiddleware(),['except'=>['getLogout']]);}/***Getavalidatorforanincomingregistrationrequest.**@paramarray$d

php - 创建 Google 联系人 --> 为什么只有 "NAME"没有插入新联系人?

这是我提出的要求:-//createnewentry$doc=newDOMDocument();$doc->formatOutput=true;$entry=$doc->createElement('atom:entry');$entry->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:atom','http://www.w3.org/2005/Atom');$entry->setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:gd','http://schemas.go