草庐IT

class-fields

全部标签

php - get_class() 期望参数 1 为对象,给定为 null

当我尝试在新的本地机器上部署Symfony2.8项目时,我在多个代码位置遇到了这个错误:"Warning:get_class()expectsparameter1tobeobject,nullgiven"在stackoverflow上没有找到这种情况,花了一些时间找出原因。 最佳答案 正如关于此问题的其他地方所述,在PHP7.2get_class中手动状态:Note:ExplicitlypassingNULLastheobjectisnolongerallowedasofPHP7.2.0.Theparameterisstillopt

php - Foursquare field 签到授权错误

我正在尝试使用以下地址显示field签到列表:https://api.foursquare.com/v2/venues/VENUE_ID/stats?oauth_token=OAUTH_TOKEN我已经注册了Foursquare应用程序并将我网站的URL指定为重定向URL。我获得了我的客户凭证并按照https://developer.foursquare.com/overview/auth中的说明进行操作创建我的代码和access_token。但是,当我尝试访问这些统计信息时,我的网络浏览器出现错误:{"meta":{"code":403,"errorType":"not_author

php - fatal error : Class 'Memcache' not found (installed with pecl)

我通过ssh安装了memcache,使用:$peclinstallmemcache这是输出:https://pastee.org/w63sy并将这一行添加到etc/php.ini:extension=memcache.so尝试初始化时:/*MEMCACHE*/$memcache=newMemcache();$memcache->pconnect('localhost',11211);我得到:Fatalerror:Class'Memcache'notfoundin/home/piscolab/public_html/website.com/includes/sql.phponline25

php - mysqli中的位标志是什么意思使用fetch_field_direct

使用mysqli,我可以像这样获取有关字段的信息$field=mysqli_fetch_field_direct($result,$fieldCount);我可以使用从结果中获取字段标志$field->flagsPHP手册说这会返回“一个表示字段位标志的整数”。但这就是我能找到的所有信息。我如何解释位标志?到目前为止,我已经解决了这个问题整数(字段长度无关紧要)根据指定的属性返回以下位标志:primarykey49967primary&unique53255uniquekey53251foreignkey53257unique&index53259(Autoincrement49675

php - 拉维尔 5.1 : Cannot redeclare class Illuminate\\Contracts\\Support\\Arrayable

我在Laravel5应用程序中收到一条错误消息:PHPFatalerror:CannotredeclareclassIlluminate\\Contracts\\Support\\Arrayablein/var/www/.../bootstrap/cache/compiled.phponline156此错误仅发生在我的暂存环境中,而不发生在我的本地网站上。我很想发布更多信息,但我没有。因为我不知道这个错误是哪里造成的。如果我删除文件(cache/compiled.php),一切似乎都正常。但是每次部署后都会出现相同的错误。在我的本地主机上,一切正常。我的问题:有没有人知道去哪里看,因为

php - Model.php 行 827 : Class not found 中的 Laravel FatalErrorException

我是Laravel的新手。我曾尝试在我的代码中使用一个示例,但结果出现错误-FatalErrorExceptioninModel.phpline827:ClassCategorynotfound。后来我修改了一行代码,修复了一个错误。但是,我其实不明白错误的原因以及我是如何解决的。这是我的代码(当我尝试使用category构建查询时的结果-我收到错误):belongsTo('Category','category_id');//return$this->belongsTo('App\Category','category_id');}}但是,当我修改一行时,我没有得到上述错误:旧行(错

php - SilverStripe $summary_field 中断标签翻译

我在我的DataObject中使用publicfunctionfieldLabels()来翻译所有字段标签(以及$summary_fields的标签)。这适用于所有字段,但具有从函数返回值(而不是从数据库中提取的值)的字段除外。摘要字段static$summary_fields=array('Label'=>'Label','Type'=>'Type','getRequiredLabel'=>'Required');字段标签publicfunctionfieldLabels($includerelations=true){$labels=parent::fieldLabels(true

php - Zend Framework 2,教程中的 "resolves to invalid controller class or alias"博客模块

我一直在按照Zend主页(https://framework.zend.com/manual/2.4/en/in-depth-guide/first-module.html)的博客教程的步骤进行操作,但我遇到了这个错误:“解析为无效的Controller类或别名”。这是我的module.config.php:array(//Openconfigurationforallpossibleroutes'routes'=>array(//Defineanewroutecalled"post"'post'=>array('type'=>'literal',//Configuretheroute

c# - C# 中的 PHP function_exists/class_exists 等价物

我正在asp.net/c#中寻找这两个函数的替代方法。if(function_exists('foo')){$returned=foo($bar);}if(class_exists('foo')){$fooclass=newfoo($bar);} 最佳答案 Assemblyassembly=Assembly.LoadFile("assemblyAddress");boolcontainClass=assembly.GetTypes().Where(x=>x.Name=="ClassName").Count()>0;boolconta

php - fatal error : Class 'Memcached' not found in/my/path

当我尝试时:$mc=newMemcached();我明白了Fatalerror:Class'Memcached'notfoundin/my/pathphpinfo说/etc/php5/apache2/conf.d/20-memcached.ini作为附加的.ini文件加载。这个文件的内容是这个:;uncommentthenextlinetoenablethemoduleextension=memcached.sodpkg--get-选择|grep内存缓存libmemcached6installmemcachedinstallphp5-memcachedinstall库本图Apache2