草庐IT

php - 单元测试时授权用户的id为空

我在Laravel4中遇到的问题:Controller中的一个简单方法:publicfunctiongetHello(){if(!\Auth::check()){returnRedirect::route('user.login');}//thisisworkingfinejustintheweb,notforphpunitintheconsoleecho\Auth::id();//thisisworkingforbothecho\Auth::user()->id;}和一个简单的测试用例:publicfunctiontestHello(){$user=User::find(1);$th

php - 带有 LDAP 错误 : User authentication is temporarily unavailable 的 Dokuwiki

我正在尝试在我的本地计算机上使用LDAP设置Dokuwiki。Dokuwiki版本是2014-05-05“PonderStibbons”身份验证设置authtype:authldap插件Authldap(捆绑插件)设置plugin»authldap»server:localhostplugin»authldap»port:10389plugin»authldap»usertree:ou=People,o=sevenSeasplugin»authldap»grouptree:ou=Groups,o=sevenSeasplugin»authldap»userfilter:plugin»au

php - Laravel 使用不同的列名重置密码

当涉及到使用不同列名称(用户名、电子邮件或密码)进行授权时,我设法使其正常工作。Howtochange/CustompasswordfieldnameforLaravel4andLaravel5userauthentication但是密码提醒似乎不起作用。我已将用户模型更改为我的表列名称。用户模型:useIlluminate\Auth\UserTrait;useIlluminate\Auth\UserInterface;useIlluminate\Auth\Reminders\RemindableTrait;useIlluminate\Auth\Reminders\Remindable

php - GAPI : Failed to authenticate user. 永久修复 PHP

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭7年前。Improvethisquestion我正在尝试从GAPI中获取内容,它有时可以正常工作,但有时会抛出此错误:ExceptionGAPI:Failedtoauthenticateuser.Error:"https://developers.google.com/accounts/docs/A

php - WordPress: fatal error :调用未定义函数 is_user_logged_in()

我正在wordpress页面中加载一个PHP脚本,但是当脚本运行时我得到了这个:Fatalerror:Calltoundefinedfunctionis_user_logged_in()它尝试运行的代码:我尝试寻找答案,但找不到可行的解决方案。根据我在互联网上发现的内容,我的脚本在wordpress之外运行,这就是它找不到函数的原因。 最佳答案 也许您运行代码的时间过早,如此处所述:https://wordpress.org/support/topic/fatal-error-call-to-undefined-function-i

php - WP 用户注册 - 也可以马上选择他/她的密码

这是一个非常简短的前端注册指南,但我在密码方面遇到了一个小问题。我禁用了在用户注册时发送的带有密码生成的电子邮件://Don'tSendNotificationEmailToRegisteredUserif(!function_exists('wp_new_user_notification')):functionwp_new_user_notification($user_id,$notify=''){//Here'soriginallypasswordgeneration+sendingemail//Addgreetingemaillater}endif;用户注册后不会收到电子邮件

php - 解析用户 : Cannot use object of type __PHP_Incomplete_Class as array

我想用Parse来保存数据。我使用ParseUser来保存用户。文档here.当我这样做时,我有一个ParseUser对象:$user=new\Parse\ParseUser();$user->set("username","myname");$user->set("password","mypass");$user->set("email","email@example.com");var_dump($user);exit();但是如果我尝试使用signUp方法。文档here.像这样:$user=new\Parse\ParseUser();$user->set("username",

php - 订单状态完成时更改购买特定产品的用户角色

因此,我帮助某人启动了一个网站,当有人购买了特定产品时,他们想要打折的产品。我找到了一个解决方案并实现了它,它在网站启动时发挥了作用,并且在客户购买产品时不再改变他们的角色。我试图从Woothemes获得支持,但他们不支持定制,并希望他们购买129美元的扩展来处理这个问题。有没有人对此有仍然有效的解决方案?这是我的代码://UpdateUseronpurchasehttps://gist.github.com/troydean/9322593functionlgbk_add_member($order_id){$order=newWC_Order($order_id);$items=$

php - 如何回显声明

这个问题在这里已经有了答案:Reference-WhatdoesthiserrormeaninPHP?(38个答案)关闭5年前。如何在if条件下回显语句。请引用代码is_logged_in()){$user_home->redirect('index.php');}$stmt=$user_home->runQuery("SELECT*FROMtbl_usersWHEREuserID=:uid");$stmt->execute(array(":uid"=>$_SESSION['userSession']));$row=$stmt->fetch(PDO::FETCH_ASSOC);?>请改

php - 尝试在 View 上访问 Auth::user()->name 时尝试获取非对象 [Laravel] 的属性

我正在尝试使用以下方法从View中获取用户名:Auth::user()->name我得到了尝试获取非对象的属性因为Auth::user()是NULL。这怎么可能?laravel生成的导航栏使用相同的方法,并且可以在那里工作。编辑:似乎我什至无法从Controller获得授权用户。Auth::guard('admin')->check();//trueAuth::user();//null有什么想法吗? 最佳答案 好吧,我又想通了,因为我使用了自定义守卫,所以我实际上需要使用:Auth::guard('admin')->user()-