草庐IT

view_type_t

全部标签

php - Laravel 错误:方法 Illuminate\View\View::__toString() 不能抛出异常

我正在使用larval4.2,我的wrapper.phpView文件中出现以下错误:with('sidebar',$sidebar)->with('active',$active);?>错误:Error:MethodIlluminate\View\View::__toString()mustnotthrowanexception你知道是什么原因造成的吗? 最佳答案 Laravel通过将Illuminate\View\View对象转换为字符串来呈现其View。如果对象被转换为字符串并设置了__toString方法,PHP将调用__to

php - 奏鸣曲管理员 - sonata_type_collection : select from the list of existing entities

我正在尝试使用PageHasImage桥接实体在Page和Image实体之间实现多对多关系。在PageAdmin中,我添加了如下字段:->add('galleryImages','sonata_type_collection',array('cascade_validation'=>false,'by_reference'=>false,'type_options'=>array('delete'=>false)),array('edit'=>'inline','inline'=>'table','sortable'=>'position','admin_code'=>'sonata.

php - 拉维 5.1 : How to share a collection in all views?

我需要在所有View中共享一个集合。此集合包含网站新闻:$news=NewsStory::orderBy('created_at','desc')->paginate(5);我该怎么做? 最佳答案 可以分享ViewData所有View之间。只需将这一行添加到App\Providers\AppServiceProvider中的boot()方法:view()->share('news',NewsStory::orderBy('created_at','desc')->paginate(5));

php - 如何从 Laravel 5.2 中的一个函数返回两个 View

我的问题有点难以解释,但我会尽量清楚地阐述它。我有一个StoreController,其中包含用于显示单页产品数据的单显示($id)函数。这个函数有一个返回语句,它是(returnView::make('store.show')->with('product',product::find($id));)但是我有另一个View,即store.category,我想在其中显示产品的类别明智结果,现在如何实现呢?我想到的一种方法是使用这个show函数并返回这个(returnView::make('store.category');)但是SHOW函数中已经有一个return了!PS:使用Res

php - Laravel 5 SQLSTATE[42S02] : Base table or view not found

我正在研究Laravel中的存储库设计模式,我正在使用https://github.com/andersao/l5-repository去做。我想我在我的项目中安装成功了。但是当我使用存储库运行代码时,我遇到了一些问题SQLSTATE[42S02]:Basetableorviewnotfound:1146Table'test.nhanviens'doesn'texist(SQL:select*fromnhanviens)我数据库中的表是Nhanvien而不是Nhanviens在我的代码中NhanvienRepository.phpNhanvienRepositoryEloquent.p

php - 未找到 Laravel 5.4 View [名称]

即使资源/View目录中的View可用,laravel也会向我显示此错误未找到View[name]。一切正常,直到出现token不匹配错误,目前我无法访问View目录中的任何View。Route::get('/',function(){returnview('welcome');});//inweb.php正在抛出View[welcome]notfound.异常注意我正在homestead中运行我的应用程序vagrant 最佳答案 我只有在homestead服务器上运行应用程序时才会遇到这个问题,我在运行phpartisanconf

php - Yii2 - 如果 View 文件不存在则重定向

如果View文件不存在,我会尝试执行类似Yii2中标准行为的操作。例如,如果View“xyz”不存在,则重定向到另一个Controller操作,或者如果我只呈现标准View(如特殊404页面)会更容易吗? 最佳答案 你可以在你的controller中做如下:render('your-view',[//...]);}catch(ViewNotFoundException$e){$this->redirect();}}}?> 关于php-Yii2-如果View文件不存在则重定向,我们在Sta

PHP7 : Methods with a scalar type declaration refuse to type juggle NULL values, 即使在弱/强制模式下

截至PHP7.0,标量类型提示int、float、string和bool可以包含在方法签名中。默认情况下,这些类型声明以弱/强制模式(或“typejuggling”模式)运行。根据PHPmanual:PHPwillcoercevaluesofthewrongtypeintotheexpectedscalartypeifpossible.Forexample,afunctionthatisgivenanintegerforaparameterthatexpectsastringwillgetavariableoftypestring.但即使可以将NULL强制转换为整数0,具有int类型提

php - 在从源代码编译的 PHP 7.1 上安装 SPL_Types

我正在尝试在从源代码编译的PHP7.1.8中安装SPL_Types扩展。我尝试使用sudopeclinstallSPL_Types并从源代码编译扩展,但我得到以下输出:https://mega.nz/#!WE5WjajQ!QyVxMYWrsUiDF6Gq09psYBpR5Y336v26PusnlBNd8bg我知道发布链接并不酷,但我无法将空洞输出放在这里。 最佳答案 此扩展现已过时,无法使用PHP7.x构建。此库的最新版本released2012年,仅支持PHP5.4。native标量类型声明支持使此扩展几乎无用(可能除了SplEn

php - "Type error: Too few arguments to function App\Http\Controllers\UserController::attendance(), 0 passed and exactly 1 expected"

我的数据库中有两个表,分别是用户表和出勤表。我现在想做的是根据用户在与他们的个人资料相关联的出勤View中显示数据库中的出勤数据。这是我在userController中的考勤功能。publicfunctionattendance($id){$user=UserProfile::findOrFail($id);$this->authorize('modifyUser',$user);returnview('user.attendance',['user'=>$user]);}这是我到出勤View的路径。Route::get('/attendance/',['as'=>'user.atte