草庐IT

view_table

全部标签

php - 将数据从 View 传递到 Controller (codeigniter)

我正在尝试使用从View到Controller的链接传递一些数据。Controller:publicfunctiondetails(){echo$this->input->post('data_id');$data['details']=$this->wapi_db->details($this->input->post('data_id'));$data['latest_news']=$this->wapi_db->latest_news();$data['main_content']="category/details";$this->load->view('includes/te

php - 使用 DB::table() 或 Model::all() Laravel 的 Eloquent

我想知道为什么很多人使用$users=DB::table('users')->get();而不是$users=Users::all();在Laravel项目中?什么是原因?问候 最佳答案 您可以这样做,因为Model和DBfacade都实现了生成Builder实例的函数。https://laravel.com/api/5.2/Illuminate/Database/Eloquent/Model.htmlhttps://laravel.com/api/5.2/Illuminate/Database/Query/Builder.html

php - 如何将 php 变量从 View (html)发送到 Controller

这是我的html代码。我想将“$category_edit->c_name”值传递给我的Update()Controller。我从另一个Controller获取“$category_edit”变量。我正在使用CodeIgniter框架。">ParentCategory:id.'">';echo$category_edit->p_name;echo'';?>Categoryc_name;?>"id="category_name"value="c_name;?>">Update这是我的update()Controller。我收到错误:undefinedvariable:category_e

php - 在布局中的 Laravel 5.3 View 中包含 PHP 变量

基于Laravel通知电子邮件模板,这是我正在尝试做的事情。我尝试为电子邮件设计一个带有变量的布局,以便在我的布局中定义一些样式,但可以在我的电子邮件View中访问。这是一个例子:emails/layout.blade.php[...]@php$style=['body'=>'font-size:12px;color:#000;','paragraph'=>'font-size:10px;color:#eee;'];@endphp@yield('content')在我的电子邮件View中:@extends('emails.layout')@section('content')Hithe

php - 如何在 codeigniter 的核心函数中加载 View 文件

我正在尝试加载application/core/MY_Controller.php中的View文件,但它给出如下。Message:Undefinedproperty:Edustaticlanding::$loadFilename:core/MY_Controller.phpMY_Controller.php中函数如下functionmenu(){$arrr=array();return$arrdata['menu']=$this->load->view('menu',$arrr,true);}我在Controller(Edustaticlanding.php)中调用这个函数如下。fun

php - 了解 Laravel View Composer : Where does my view composer belong?

我正在阅读Laravel文档以加深理解,这将是我第二次遇到一些困惑。不久前,我正在观看一个Laracasts视频,其中我们在AppServicesProvider注册方法中实现了一个Viewcomposer。看起来像这样:publicfunctionregister(){view()->composer('layouts.sidebar',function($view){$archives=\App\Post::archives();$tags=\App\Tag::has('posts')->pluck('name');$view->with(compact('archives','t

php - 返回或回显 View 有什么区别?返回 View 比 echo View 说话的时间更长

加载View的最佳做法是什么。文档说在此处加载Viewhttps://laravel.com/docs/5.7/views以下是我的代码:if(isset($results['status'])){$error[]=$results['msg'];$request->session()->flash('message.level','danger');$request->session()->flash('message.content',$error);}else{if(view()->exists('import.device.results')){echoview('import

php - 如何更改模型中的 Zend_Db_Table 名称以插入多个表

使用ZendFramework,我创建了一个模型来将记录插入数据库。我的问题是,在$this->insert($data)之后,如何切换事件表以便将记录插入另一个表?到目前为止,这是我的代码:classModel_DbTable_FooextendsZend_Db_Table_Abstract{protected$_name='foo';publicfunctionaddFoo($params){$data=array('foo'=>$params['foo'],);$this->insert($data);$foo_id=$this->getAdapter()->lastInsert

php - 在 hook_views_query_alter() 中添加 JOIN 语句

我需要修改Views生成的查询,以便我可以使用高度自定义的过滤器。由于这个问题,我已经用一些OR实现了add_where()函数:ORoperatorinDrupalViewFilters然而,这只解决了我的部分问题。有些字段我无法过滤,因为我需要在查询中加入额外的JOIN。是否有类似的东西$view->query->add_where()可以插入JOIN语句吗? 最佳答案 我找到了答案here.无耻复制:functionhook_views_query_alter(&$view,&$query){$join=newviews_jo

php - 将表格暴露给 View

我有一个由模块创建的表。我需要将它的一些字段包含到现有View中。我尝试使用thetablewizardmodule,但它所做的只是为该表创建一个单独的View。我希望能够从该表中选择字段作为附加字段添加到现有View中,或者通过关系或类似的方式添加。有没有解决方法来做我想做的事情? 最佳答案 啊。意见。我也花了一段时间。这个答案是针对Drupal6的,在摘要中展示了如何定义字段以及如何使用关系来允许字段链接到节点表。在modulename.module中,你想要一个函数:functionmodulename_views_api()