草庐IT

using_view_debugger

全部标签

php - Laravel - 在传递给 View 之前编辑数据

我正在寻找一种在将数据传递给查看之前对其进行编辑的方法。快速示例(只是为了演示):假设我正在传递变量$name通过Controller查看。我想用一些东西来传递另一个变量$message其中将包含Hello$name,例如HelloJohn,如果变量$name将是约翰。我不想在Controller中发送第二个变量,因为我会使用很多Controller、View,而且我想对数据做的事情相当复杂。我需要将它用于两个变量view("foobar",["foo"=>"bar"])和sessionview("foobar")->with("foo","bar").我尝试同时使用中间件和服务提供商

php - Symfony @ParamConverter : exclude the use if the placeholder does not contain a dot

我有这个Controller:/***{@inheritdoc}**@Route("entity/{domain_host}")*@ParamConverter("entity",class="AppBundle:Entity",options={*"repository_method"="findOneByDomainHost",*"mapping":{"domain_host":"domainHost"},*"map_method_signature"=true*})*/classEntityControllerextendsController{...}通过这种方式,像http:

php - 拉维尔 5.4 : execute a raw query and show data in view

我想运行一个我在我的Controller中编写的原始查询,并想在我的View中显示来自数据库的数据。这是我的Controller函数:publicfunctionunverified_jobs_page(){$query="SELECTjd.*,cd.`company_name`,jc.`category_title`,jt.`job_type_title`,cc.`city_name`FROM`job_details`ASjdJOIN`company_details`AScdONcd.`company_id`=jd.`company_id`JOIN`job_category`ASjc

php - UserPolicy 类不存在(查看 : F:\xampp\htdocs\gates_policies\resources\views\home. blade.php)

这是我的AuthServiceProvider文件,'App\Policies\ModelPolicy',User::class=>UserPolicy::class,];/***Registeranyauthentication/authorizationservices.**@returnvoid*/publicfunctionboot(){$this->registerPolicies();Gate::define('display_msg','UserPolicy@display');}}在我的blade文件中,我尝试显示“HelloWorld”,前提是用户在Laravel中使

php - Zend 框架 : Setting decorators and labels - should this be done in the view or the form class?

我注意到许多(大多数?)人在使用ZendFramework时会在Form类本身中添加装饰器和标签。classUser_Form_AddextendsZend_Form{publicfunctioninit(){parent::init();$username=newZend_Form_Element_Text('username');$username->setLabel('Username:')->setRequired(true)->addFilter('StringTrim')->addValidator('StringLength',$breakChainOnFailure=f

php - 身份验证组件 : Which pattern can I use? (PHP)

我正在尝试构建一个尽可能分离的身份验证组件,允许不同类型的身份验证(例如:http、摘要、数据库等),就像zend_auth:http://framework.zend.com/manual/en/zend.auth.html他们使用的模式有名字吗?你能推荐我一个不同的方法吗?也许是Bridge或Strategy模式? 最佳答案 根据您提供的链接:Zend_AuthprovidesanAPIforauthenticationandincludesconcreteauthenticationadaptersZend_auth本身就是S

php - Zend View Helper 中的数据库连接

在ZendViewHelper中使用数据库映射器是一种好习惯吗?因为在我的例子中,这个helper正在给我做一盒它会实时变化,并将显示在我的应用程序中的所有View中。我不可能让该对象从Controller中的数据库加载它并每次都将其分配给查看。如果有人能告诉在使用zendviewhelpers时要遵循的良好编程实践,那将非常有帮助,例如:如果可以通过$this->view->variable=...;将某些内容分配给View助手中的View如果可以在ViewHelpers中创建和使用模型。如果可以在ViewHelper中使用Zend_View可用的方法,比如$this->view->

php - 发送 : How to manage XML data where multiple elements have the same name using Zend_Config_Xml?

尝试使用Zend_Config_Xml从XML文件中提取数据,我正在寻找处理多个元素具有相同名称的数据的最佳方法。请看下面的例子。这是XML文件:example1.cssexample2.css代码如下:$data=newZend_Config_Xml('./path/to/xml_file.xml','stylesheets');$stylesheets=$data->stylesheet->toArray();我想做的是遍历$stylesheet使用foreach循环的数组,提取文件名,然后将样式表附加到headLink().这工作正常...但是,当的数量时,我遇到了问题元素小于2

php - session 在新页面 View 中被破坏

成功登录后,我将保存session变量。当用户转到应用程序中的不同页面时,即使我没有明确销毁session,session也会消失。我该如何解决这个问题?这是session似乎消失的页面。在core/init.php中,我有session启动方法。 最佳答案 session_start()createsasessionorresumesthecurrentonebasedonasessionidentifierpassedviaaGETorPOSTrequest,orpassedviaacookie.(VisitPHP:sessio

PHP 继承 : child class overriding parent variable/property for use in constructor

我有一个(抽象的)父类应该在构造期间提供功能。子类可以覆盖构造函数中使用的属性:classParentextendsMiddlewareTest{//abstractchannelpropertiesprotected$title=NULL;protected$type=NULL;protected$resolution=NULL;function__construct(){parent::__construct();$this->uuid=$this->createChannel($this->title,$this->type,$this->resolution);}}classC