草庐IT

user-variables

全部标签

php - Laravel, Controller 中的 Auth::user()

Laravel框架-为什么我不能在Laravel项目的Controller中使用Auth::user()(查看用户是否已登录)。Session是否未连接到Controller?HomeController.phppublicfunctionisauthorized(){if(Auth::user()){returnView::make('home.basic')->with('basic1','Authorized');}else{returnView::make('home.basic')->with('basic1','NotAuthorized');}}我的登录系统正在运行,登录

php - 在处理可能 undefined variable 时,在 PHP 中使用引用赋值是不好的做法吗?

我一直在考虑使用引用赋值作为处理潜在undefinedvariable的捷径。换句话说,代替:$foo=isset($this->blah['something']['else'])?$this->blah['something']['else']:null;if(!is_null($foo)&&...){//dosomethingwith$foo}我可以这样做:$foo=&$this->blah['something']['else'];if(!is_null($foo)&&...){//dosomethingwith$foo}看起来更简单,对吧?由于PHP通过引用处理赋值的方式,我

php - Symfony2 身份验证 : How can I select a user provider dynamically?

在登录表单上,用户将被允许选择他所属的公司。根据他的选择,他将针对database1或database2或LDAPserver1等进行身份验证。我知道Symfony2中有一个链提供者选项,但我不希望应用程序遍历所有提供者,而是直接转到适当的服务器。基本上,我想动态选择用户提供者。我如何在Symfony2中做到这一点?或者对于这种身份验证,什么可能是更好的解决方案?谢谢 最佳答案 也许这就是您要找的东西?dynamicformmodification 关于php-Symfony2身份验证:

php - G Suite SSO 错误 app_not_configured_for_user

我正在将GoogleGSuiteSAML/SSO集成到我们公司的网络应用程序中。我已经在我们的GSuite管理员帐户以及我们的服务提供商代码中设置了所有必要的字段。以下是尝试访问我们的网络应用程序时登录效果很好的情况:未登录任何Google帐户:将我重定向到Google“选择帐户”页面。我登录到我的公司帐户,然后我被重定向到我的应用程序。同时登录我公司的Google帐户和我的个人Google帐户(在同一浏览器中):将我重定向到Google“选择帐户”页面。我选择我的公司帐户,然后我被重定向到我的应用程序。这是登录行为不理想的情况:我只登录了我的个人Google帐户。我尝试访问我公司的应

php - Valums 文件 uploader : Limit uploads by users credit

我正在使用Valums出色的文件uploader-https://github.com/valums/file-uploader我想添加的一件事是基于用户帐户余额的限制。第一张图片始终免费,因此即使您的余额为0,您也可以上传一张图片。额外的图片需要0.50的值(value)或积分。如果他们没有足够的信用,它将显示警报并且不会上传文件。余额可以从phpsession变量$_SESSION['user']['credit']这是目前的代码functioncreateUploader(){varrunning=0;varuploader=newqq.FileUploader({multipl

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 - 如何在 Codeigniter Rest_controller 中将 `user` 名称更改为其他名称,如 `client`?

这是我当前使用CodeigniterRest_controller的urlhttp://localhost/api/user/id/1/format/xml我的预期输出http://localhost/api/client/id/1/format/xml 最佳答案 经过多次尝试,现在我得到了答案..这是我当前导致username的代码methods['user_get']['limit']=500;//500requestsperhourperuser/key$this->methods['user_post']['limit']=

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