草庐IT

view_count

全部标签

PHPUnit 模拟 View 助手 ZF2

我创建了一个View助手:classSousMenuContratextendsAbstractHelper{private$maiContratService;publicfunction__construct(FMaiContratService$maiContratService,){$this->maiContratService=$maiContratService;}publicfunction__invoke($iMaiContratId,$sActive){$oContrat=$this->maiContratService->selectById($iMaiContr

php - 如何在 PHP 中将多个值从 View 传递到 Controller

我是PHP的新手,我正在尝试将2个整数从我的View传递到我的Controller。我正在使用zend框架2。这是我尝试通过按钮将数据传递到Controller中的操作的方式,但我在操作中收到的值等于0,所以这是错误的,因为我的值不等于0。url('mediador',array('action'=>'associaCorrespondencia','idCompra'=>$Compra[$i]['ID'],'idVenda'=>$Venda[$i]['ID']));?>"method="post">以下是我在操作中接收值的方式:publicfunctionassociaCorresp

php - Laravel 从所有 View 访问数据

在我所有的View中,我已经能够默认访问{{Auth::user()->name}},我正在尝试添加访问{{Profile::user()->...}}在我看来也是如此,但我遇到了一些麻烦。如果不需要的话,我真的不想使用ViewComposerthispostsuggests因为看起来我需要手动列出每个View。相反,我选择使用AppServiceProviderbootmethod在文档中列出。问题是我仍然无法调用{{Profile::user()->title}}例如。我收到以下错误:ErrorExceptioninAppServiceProvider.phpline19:Non-

php - 在订单项目 View 中显示自定义产品数据

我对添加到购物车有疑问。我有一个具有不同自定义条件的产品可供选择。当客户选择特定选项时。它添加到购物车。当客户选择另一个选择并添加。它显示为购物车中的第二项。没关系。但是付款后,订单显示的是item1和item2下的自定义选项,没有自定义数据。所以我在想,而不是将相同的产品展示为不同的商品。我想更新产品自定义数据,因此它将始终显示为单个项目。(注意:我已从管理员启用“单独销售”选项,但它有效)。如果不行你能告诉我如何在订单中正确显示,这样付款后发送的邮件,订单页面才会正确显示。注意:我使用的自定义数据是位置和日期。提前谢谢你。 最佳答案

php - Laravel: Blade View 中的 undefined variable

这是AdminController.php:$images]);}}这是admin.blade.php:@extends('template')@section('title')AdminPage@endsection@section('header')@endsection@section('main')@if(Auth::check())@foreach($imagesas$image)id}}'>{{$image->content}}id}}/delete"method="post">Deletecaptionid}}/approve"method="post">Acceptim

php - 如何在资源/ View 目录 Laravel 中创建文件

我正在使用Laravel5.0,如果它没有像这样退出,我正在尝试创建一个Viewif(view()->exists($moduleName.$getCategoryNameToLowerCase)){//ifexistreturntheviewreturnview($moduleName.$getCategoryNameToLowerCase);}else{//elsecreateaviewandreturnit;fopen(app_path('../resources/','views/'.$moduleName.'.'.$getCategoryNameToLowerCase.'.b

php - 将数据从 Controller 传递到 Blade View laravel

我正在尝试通过href将参数发送到从事件列表到事件页面的页面。我的路线是Route::get('eventpage','EventController@index')->name('eventpage');我的事件Controller是query('id');$event=DB::table('events')->where('id',$id)->get();$pics=DB::table('pictures')->where('event_id',$id)->get();$n=count($pics);//thenumberofpicturesforaparticulareventr

php - array_count_values 我想回显一个特定的键值

我忙于一家网上商店,我想回复一下今天有多少订单需要交付我有一个循环,其中包含以下代码:$winkels[]=$vendor->id;这很好,因为我做了以下代码:echo''.print_r(array_count_values($winkels),true).'';比我得到的结果:Array([63]=>1[45]=>1[85]=>1[59]=>1)结果很好,但是我怎么能回显id:63的值呢?有人能帮帮我吗? 最佳答案 对于单例:-$data=array_count_values($winkels);echo$data[63];对于

php - 如何在 laravel Blade View 上定义变量数组?

我这样尝试:@foreach($categoriesas$category)@php$category[]=$category->name@endphp@endforeach{{implode(",",$category)}}如果执行代码,存在错误:undefinevariablecategory我该如何解决? 最佳答案 你可以简单地使用Laravel集合{{$categories->pluck('name')->implode(',')}}或者如果你想在foreach中这样做@php($names=[])@foreach($cat

php - LARAVEL - 未找到基表或 View : 1146 Table doesn't exist (SQL: select * from )

这个问题在这里已经有了答案:DBquerytakingwrongtablenameonlaravel[duplicate](1个回答)Laravel-Database,TableandColumnNamingConventions?(4个答案)关闭去年。我有一个Mysql数据库minho.win和一个名为utilizadores的表。我创建了一个模型类phpartisanmake:modelUtilizador当我执行phpartisantinker然后执行App\Utilizador::all()时,我收到此错误:Illuminate\Database\QueryExceptionw