草庐IT

model-binding

全部标签

php - 复选框的表单模型绑定(bind)

我正在使用Laravel4.1,在我的应用程序中,我需要显示一个带有预填复选框的表单。但我尝试使用FormModelBinding来做到这一点,但它不起作用。{{Form::model($user,array('route'=>'settings-notify'))}}{{Form::checkbox('notify_visit','1')}}{{Form::checkbox('notify_rate','1')}}{{Form::submit('Save')}}{{Form::close()}}有什么办法让它工作吗? 最佳答案 我

php - 为什么我会收到 "Class ' app\models\Yii' not found"错误?

出现此错误的模型函数:publicfunctionsetPassword($password){$this->password_hash=Yii::$app->security->generatePasswordHash($password);}publicfunctiongenerateAuthKey(){$this->auth_key=Yii::$app->security->generateRandomString();} 最佳答案 添加useYii;在你的类声明之前。或者在Yii字前加一个反斜杠。$this->passwor

php - php 的 fuse 绑定(bind)

我正在编写一个应用程序,到目前为止,它是用PHP编写的,从界面到守护进程。我需要使用fuse并希望继续使用PHP只是为了保持一致性。但是,似乎没有PHP的绑定(bind)。Python、Java等有绑定(bind),我可以用这些语言编写代码,我只是不想在这个项目中有额外的依赖项。我看过一个关于谷歌代码的项目,但没有完成。有谁知道这些有没有写? 最佳答案 我为PHP编写了一个扩展,它提供了对libfuse的绑定(bind)。我已经阅读支持工作,但还没有完全完成写支持。最终我会完成它,但如果你喜欢它,我很乐意打补丁。http://pec

php - 忘记后期静态绑定(bind),我需要后期静态 __FILE__

我正在寻找__FILE__的get_called_class()等价物……也许像get_included_file()?我有一组类想知道它们存在于哪个目录中。像这样:baseDir=dirname(__FILE__);}publicfunctiongetBaseDir(){return$this->baseDir;}}?>在其他文件中,在其他文件夹中...getBaseDir();$b=newB;echo$b->getBaseDir();$c=newC;echo$c->getBaseDir();//Annnd...allthreereturnthesamebasedirectory.?

php - 什么是 PHP 中的调用转发和静态调用或其他后期静态绑定(bind)?

关闭。这个问题需要更多focused.它目前不接受答案。想改进这个问题吗?更新问题,使其只关注一个问题editingthispost.关闭8年前。Improvethisquestion我从网站获得的一个代码示例,但我很难理解输出。我正在分享代码:classA{publicstaticfunctionfoo(){static::who();}publicstaticfunctionwho(){echo__CLASS__."\n";}}classBextendsA{publicstaticfunctiontest(){A::foo();parent::foo();self::foo();}

php - ( fatal error : Call to a member function bind_param() on a non-object)

这个问题在这里已经有了答案:Whattodowithmysqliproblems?Errorslikemysqli_fetch_array():Argument#1mustbeoftypemysqli_resultandsuch(1个回答)关闭4个月前。我收到此文本的错误:(抱歉我的英语不好,我来自德国!)错误:fatalerror:在第44行/users/ftf/www/ccache.php中的非对象上调用成员函数bind_param()部分代码来自ccache.php//NeuesDatenbank-Objekterzeugen$db=@newmysqli('localhost',

php - 如何将 Laravel 表单模型绑定(bind)与 Bootstrap 一起使用?

我正在尝试显示绑定(bind)到我的用户模型的Bootstrap格式的表单。但是,表单模型绑定(bind)似乎只有在我使用未使用Bootstrap样式格式化的输入字段时才有效。这是一个没有Bootstrap类的,当我打开我的表单时,它完美地显示了我在我的数据库中的内容:{{Form::model($user)}}{{Form::label('name','Vorname:')}}{{Form::text('name')}}这是此表单的第二个输入,现在带有Bootstrap类。这个不显示数据库内容。{{Form::label('sirname','Nachname:')}}{{Form:

php - 消息:未定义的属性:Site::$Site_model - CodeIgniter

我正在自动加载已经在自动加载配置中的库site_model,这是我遇到的错误:APHPErrorwasencounteredSeverity:NoticeMessage:Undefinedproperty:Site::$Site_modelFilename:controllers/site.phpLineNumber:16Fatalerror:Calltoamemberfunctionadd_record()onanon-objectin/Applications/XAMPP/xamppfiles/htdocs/BLOCK/application/controllers/site.ph

php - 使用 codeigniter PHP fatal error : Class 'MY_Model' not found

现在我正在学习CodeIgniter_2.1.4,但是我遇到了一个php错误;我在/data/www/application/core中有一个my_model.php文件db->insert($this::DB_TABLE,$this);$this->{$this::DB_TABLE_PK}=$this->db->insert_id();}privatefunctionupdate(){$this->db->update($this::DB_TABLE,$this,$this::DB_TABLE_PK);}publicfunctionpopulate($row){foreach($ro

php - 在不绑定(bind)的情况下在 PDO 中运行查询

您可以在不准备PDO的情况下运行查询吗?我知道随之而来的SQL注入(inject)问题,但我在测试环境中。我希望能够编写纯MySQL查询并直接执行它们,而不必准备查询、绑定(bind)占位符等...我希望能够立即执行如下查询。INSERTINTOtable(table_id,car,bike,date)VALUES(1,'bmw','suzuki',2004)我似乎在直接对此查询运行execute()时遇到错误。提前致谢。 最佳答案 preparedstatements的主要思想不是你可以绑定(bind)参数,而是你可以多次重用编译