草庐IT

object-call

全部标签

php - fatal error : Call to undefined function asset() in C:\wamp\www\laravel-master\app\views\hello. PHP

我想学习laravel框架。我可以在我的网络服务器(Wamp)中安装laravel,我得到了一些学习它的教程,但是当我尝试将样式添加到hello.php文件中的“h1”标签时,位于该路径中:(“C:\wamp\www\laravel-master\app\views\hello.php")通过asset()函数,出现上述错误。请帮我找出问题所在。这是hello.php代码:body{margin:0;font-family:'Lato',sans-serif;text-align:center;color:#999;}.welcome{width:300px;height:200px;

php - 解析用户 : Cannot use object of type __PHP_Incomplete_Class as array

我想用Parse来保存数据。我使用ParseUser来保存用户。文档here.当我这样做时,我有一个ParseUser对象:$user=new\Parse\ParseUser();$user->set("username","myname");$user->set("password","mypass");$user->set("email","email@example.com");var_dump($user);exit();但是如果我尝试使用signUp方法。文档here.像这样:$user=new\Parse\ParseUser();$user->set("username",

php - fatal error : Call to undefined function mb_strtolower(): enable mbstring on linux EC2

我已经通过sudoyuminstallphp-mbstring在我的带有php5.6.17的linuxEC2实例上安装了mbstring。我怎样才能启用它? 最佳答案 需要使用yuminstallphp56-mbstring。安装后,无需配置,只需重启httpd服务即可 关于php-fatalerror:Calltoundefinedfunctionmb_strtolower():enablembstringonlinuxEC2,我们在StackOverflow上找到一个类似的问题:

php - 何时使用 call_user_func_array

我在stack上阅读了其他答案关于使用call_user_func_array与仅调用函数有关,但我仍然无法收集何时应该使用前者。我知道当您不知道传递了多少个参数时,您可能想使用call_user_func_array,因此您可以这样做:$args=func_get_args();...但是如果要在函数中使用参数,您不总是需要知道参数吗?以下两项工作,我假设第一项的开销较小。$format=newFoo;$method='somemethod';$arg='somevalue';if(method_exists($format,$method)){return$format->$met

php - 正则表达式将哈希封闭的 `##WORD=123##` 替换为方括号`[object word=123]`

我想用方括号替换主题标签,并在第一个方括号后添加一个词,所有字符串都需要小写。示例字符串:$str="Thisissometext##IDOBJECT=784##andanothersometext##IDOBJECT=1509####LATESTARTICLESHOME=321####IDOBJECT=321##";我想用[objectidobject=123]替换##IDOBJECT=123##格式的字符串。请注意,这里在第一个[括号和IDOBJECT字符串转换为idobject之后添加了额外的object词。我尝试使用此/(\##.*?\##)/正则表达式来查找这些字符串,但无法

php - 如果存在则调用子类的 __call 方法,如果不存在则抛出异常

[edit]更新了标题以更准确地反射(reflect)问题我要解决的问题是:我需要知道是否通过parent::调用了一个方法,虽然我可以使用debug_backtrace,但它似乎在那里一定是执行此操作的更好方法。我一直在研究后期静态绑定(bind),但也许我对它的理解不够深入,无法找到解决方案。有问题的方法是__call,所以我不能简单地传入一个额外的参数,因为它的错误是多于或少于恰好两个。试图解决这个问题的原因是父类有__call但子类可能有也可能没有_call。如果child没有,并且parent没有派发电话,那么我想抛出异常或错误。如果child确实有该方法,那么我将返回fal

php - 警告 : get_class() expects parameter 1 to be object

一周前我写了一个代码,它运行良好。但是今天当我检查它时,它给了我一些问题,比如Warning:get_class()expectsparameter1tobeobject,arraygivenin/home/ccc/public_html/horoscope/xml2json.phponline182Warning:get_class()expectsparameter1tobeobject,stringgivenin/home/ccc/public_html/horoscope/xml2json.phponline182Warning:get_class()expectsparame

php - Zend 框架 2 : Getting an ordered SQL call

我一直在尝试获取一个字段的ASC/DESC调用顺序(假设已创建),但我似乎无法弄清楚如何在ZF2中执行此操作。我哪里错了..?namespaceTodo\Model;classTodoTableextendsAbstractTableGateway{publicfunction__construct(Adapter$adapter){$this->adapter=$adapter;$this->resultSetPrototype=newResultSet();$this->resultSetPrototype->setArrayObjectPrototype(newTodo());$

php - 布局在 Laravel 4 中抛出 "Attempt to assign property of non-object"

在Layouts文件夹中,我有一个名为signup.blade.php的布局在我的Controller中,我像这样为其分配布局:protected$layout='layouts.signup';在一个名为“signup”的单独文件夹中,我有一个名为“signup1.blade.php”的文件,它包含典型的Blade模板内容。这是一个名为“内容”的部分。在我的代码之前@section('content')最后有@stop。我的Controller看起来像这样:publicfunctionSignUp(){$this->layout->content=View::make('signup

php - 对象通过引用传递。 call_user_func 的参数不是。是什么赋予了?

在PHP中,objectsareeffectivelypassedbyreference(引擎盖下发生的事情是abitmorecomplicated)。同时,call_user_func()的参数不通过引用传递。那么像这样的一段代码会发生什么?classExample{functionRunEvent($event){if(isset($this->events[$event])){foreach($this->events[$event]as$k=>$v){//call_user_func($v,&$this);//TheabovelineisworkingcodeonPHP5.3.