开发者

how to use session in ajax file using codeigniter

开发者 https://www.devze.com 2023-03-08 16:23 出处:网络
there is a php file that i am calling using ajax through a view. xmlhttp.开发者_运维百科open(\"GET\",\"/my/path/to/background_file.php\");

there is a php file that i am calling using ajax through a view. xmlhttp.开发者_运维百科open("GET","/my/path/to/background_file.php");

that php file is doing some background process and hence i do not need any controller/ view for that file. its an independent file.

considering that i do not need any controller/ view for that php file, can i access session variables there ? how ?

where should i keep these kind of php files which do not need any view/ controller?

thanks in advance. i am using codeIgniter 1.7.2

dev


If you want to access objects in Codeigniters session array, I'd suggest making your ajax file a controller. It's pretty common to create an ajax controller so you can access Codeigniter's functionality. Of course, you don't need a view connected to the controller, you simply echo json_encode($data) to return any required data.

0

精彩评论

暂无评论...
验证码 换一张
取 消