Home >php教程 >PHP源码 >Solve the problem of session loss when uploading multiple pictures in kindeditor in PHP

Solve the problem of session loss when uploading multiple pictures in kindeditor in PHP

WBOY
WBOYOriginal
2016-07-06 13:34:241741browse

Session loss is very strange. I often encounter a session loss problem that has not been solved yet. Today, I encountered a session loss problem when uploading multiple pictures in kindeditor. Let’s take a look at the solution.

Solution:

1. Add session_id when creating a text editor


<script><br> var editor;<br> KindEditor.ready(function(K) {<br> Editor = K.create('textarea[name="content"]', {<br>           allowFileManager : true,<br>         extraFileUploadParams:{<br>              'PHPSESSID' : "<?=session_id()?>"<br> }<br> });</p> </script>

2.upload_json.php file adds session initialization

$session=isset($_POST['PHPSESSID'])?$_POST['PHPSESSID']:'';

if($session){//Reset cookies to solve the problem of cookie loss when uploading images using Flash

session_id($session);

session_start();


}else{
Session_start();

}<script>ec(2);</script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn