这似乎是一个两步的过程,
$u = $this->Auth->user();
$uid = $u['User']['id'];
用户登录后是否会在某处设置变量?
您可以使用$uid = $this->Auth->user('id');
查看api文档:https://api.cakephp.org/1.3/class-AuthComponent.html#_user https://api.cakephp.org/1.3/class-AuthComponent.html#_user
对于使用较新的 Cakephp v4.x 的每个人:https://api.cakephp.org/4.4/class-Cake.Controller.Component.AuthComponent.html#user() https://api.cakephp.org/4.4/class-Cake.Controller.Component.AuthComponent.html#user()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)