donglun2024 2016-11-20 07:27
浏览 27

如何在cakephp 3.x中的插件中检索会话值

I integrated "blueimp" image uploader in CakePHP 3, I put "imagehandler" in plugin folder who is responsible for uploading and all other actions. it is working perfectly but I need to access user_id from Session in "imageHandler" (plugin file) but I could not get it. I did it like this

include('../plugins/UploadHandler.php');  
$upload_handler = new UploadHandler(); 

It works but I learned from SO that I need to pass $this argument if i need to access session in plugin file like this.

$upload_handler = new UploadHandler($this);

In initiliaze function of this file, I tried to read it. but other code use $this give error.

But code in "UploadHandler" file gives the error.
can you suggest any idea how I can access session value in plugin file.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于大棚监测的pcb板设计
    • ¥20 sim800c模块 at指令及平台
    • ¥15 stm32开发clion时遇到的编译问题
    • ¥15 lna设计 源简并电感型共源放大器
    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计