草庐IT

multiple-variable-return

全部标签

php - Symfony/学说 : Why my integer Entity attribute is returning as string?

我有一个实体,其属性定义如下:/***@varinteger**@ORM\Column(name="weight",type="integer")*/private$weight;我试图解决一个错误并使用var_dump()来了解正在发生的事情......响应是:string'20'(length=2)我不明白为什么$weight作为字符串返回...它不应该是一个整数吗?int20或者我应该在我的业务逻辑中处理它吗?编辑(我如何调用var_dump()):我有一个名为“Calculator”的类,它迭代$items并使用$weight属性。是这样的:Controller:$calcul

php - Return redirect() 没有将我带到所需的方法

我正在使用CodeIgniter3构建博客。我想在用户通过身份验证但redirect()不起作用时从一个Controller重定向到另一个Controller。我已经尝试了StackOverflow中提供的所有解决方案,但没有一个适合我。检查我的代码并告诉我问题出在哪里。提前致谢。MY_Controller是我从CI_Controller扩展而来的核心Controller。登录_c.phpclassLogin_cextendsMY_controller{publicfunctionindex(){$this->load->helper('form');$this->load->view

php - 交响乐 : multiple applications in one test

我正在为我的项目的后端应用程序模块编写功能测试。为了测试某些功能,我需要从前端应用程序模拟用户操作。所以,我创建了2sfTestFunctionalinstances:$frontendBrowser=newfrontendTestFunctional();$backendBrowser=newbackendTestFunctional();这些类基本上都继承自sfTestFunctional。现在,正如我们所知,symfony中的每个应用程序都有自己的上下文实例,所以我们必须先切换到它:sfContext::switchTo('frontend');//thisworksfine$f

php - $_SERVER ['REQUEST_METHOD' ] return GET insted POST

我使用这样的post方法创建了一个表单:actionErrors)){echo$this->actionErrors;}?>Amount$price;?>USD .....但问题是当我执行“var_dump($_SERVER['REQUEST_METHOD']);”在我的PHP代码中,我总是得到“GET”而不是“POST”,我真的不知道为什么? 最佳答案 我刚刚在使用Codeigniter的MVC框架时遇到了这个问题。这是我的发现:我表单中的Action属性不包含域前面的“www”,但我的实际URL需要“www”。即我的表

PHP PDO : How to insert multiple rows?

我有很多sql语句,但我想要,但我想知道是否有任何方法或函数可以使用PHPPDO缩短并在尽可能少的行中执行。我的一个想法是创建一个具有以下名称的数组:Perfiles、Usuarios、Customer、Mps、Poliza和Servicios在一起就像foreach,但我没有具体的想法,你能帮我吗?SQL语句$sqlpermsPer="INSERTINTOt_perfiles_permisos(Id_Perfil,Area_Permiso,Buscar,Crear,Eliminar,Modificar)VALUES($idPerfil,'Perfiles',0,0,0,0)";$re

php - Laravel 5 : How can I pass a variable from a controller method to app. Blade .php?

我在布局文件app.blade.php中显示了一个变量。该变量在我的全局“ViewComposer”中定义了一个默认值。我需要从Controller方法中覆盖该值,我该怎么做? 最佳答案 这是一个棘手的问题。问题是View编写器在Controller返回View后被触发。但是,如果已设置该值,您可以在View编辑器中检查:publicfunctioncompose(View$view){if(!$view->offsetExists('foo')){$view->with('foo','default');}}当您想“覆盖”Cont

php - Laravel DI : call controller method without passing injected variable, 这可能吗?

classSomeControllerextendsController{publicfunctiondoALot(Request$request){$this->doOne($someOtherVariable);//Typeerror:Argument1passedtoApp\Http\Controllers\SomeController::doOne()mustbeaninstanceofIlluminate\Http\Request$this->doOne($request,$someOtherVariable);//Badpractice?...}publicfunction

php - Laravel Blade View - undefined variable : errors

当访问我的laravel应用程序的登录页面时,我得到一个Undefinedvariable:errors(View:D:\PhpstormProjects\laravel\resources\views\login.blade.php)错误。根据http://laravel.com/docs/master/validation#error-messages-and-views,$errors应该总是自动设置:So,itisimportanttonotethatan$errorsvariablewillalwaysbeavailableinallofyourviews,oneveryre

php - CakePHP 3 Multiple isUnique 允许 NULL 重复

我的BlockedTable.php中有以下规则publicfunctionbuildRules(RulesChecker$rules){$rules->add($rules->isUnique(['date','time']),['message'=>'uniqueerror']);return$rules;}到目前为止,这一直运行良好-如果我尝试使用已有的日期和时间保存新记录,它会阻止我保存。但是,如果我的时间是NULL,比如下面的条目;╔════╦══════════════╦═══════╗║ID║Date║Time║╠════╬══════════════╬═══════╣║

php - 第一次尝试 Laravel undefined variable

今天早上发生在我身上最奇怪的错误之一当我第一次尝试打开模型的展示Blade时,我得到了这个Undefinedvariable:engs(View:C:\wamp64\www\Form\resources\views\dashboard\placeShow.blade.php)但是当我刷新页面或重新打开它时一切正常我的Controller:publicfunctionshowPlace($id){$place=Place::find($id);if(!$place->seen->contains(Auth::user()->id)){$place=$place->seen()->save