{"id":1649,"date":"2015-08-28T08:13:43","date_gmt":"2015-08-28T00:13:43","guid":{"rendered":"http:\/\/clear.vimge.com\/?p=1649"},"modified":"2015-08-28T08:18:32","modified_gmt":"2015-08-28T00:18:32","slug":"thinkphp-uploadify-session-flash","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/front-end\/thinkphp-uploadify-session-flash.html","title":{"rendered":"ThinkPHP\u4f7f\u7528Uploadify\u7b49flash\u4e0a\u4f20\u63d2\u4ef6\u65e0\u6cd5\u4f20\u9012session\u7684\u95ee\u9898"},"content":{"rendered":"

\u5728ThinkPHP\u5728\u4f7f\u7528Uploadify\u6216\u5176\u4ed6\u57fa\u4e8eFlash\u7684\u4e0a\u4f20\u63d2\u4ef6\u7684\u65f6\u5019\u5f88\u591a\u4eba\u4f1a\u78b0\u5230\u4e0a\u4f20\u63a7\u4ef6\u65e0\u6cd5\u4f20\u9012Session\u7684\u95ee\u9898\uff0c\u7279\u522b\u662fFirefox\u6d4f\u89c8\u5668\u4e0a\u9762\u3002\u5b98\u65b9\u89e3\u91ca\u53ef\u4ee5\u5c06session id\u901a\u8fc7\u63d2\u4ef6\u53c2\u6570\u4f20\u9012\u5230\u540e\u7aef\uff0c\u4ee5\u4e0b\u662fUploadify\u5b98\u65b9\u89e3\u51b3\u65b9\u6848\uff0c\u4f46\u5b9e\u6d4b\u65e0\u6cd5\u5b9e\u73b0\u4f20\u9012Session.<\/p>\n

\u672c\u4eba\u4f7f\u7528\u73af\u5883\u662fThinkPHP3.2.2\uff0cFirefox\u3002<\/p>\n

\u6d4f\u89c8\u5668\u63d2\u4ef6\u914d\u7f6e<\/strong>
\n$(‘#file_upload).uploadify({
\n \/\/ Your normal options here
\n formData:{‘<?php echo session_name();?>’: ‘<?php echo session_id();?>’}
\n});<\/p>\n

\u670d\u52a1\u7aef<\/strong>
\n$session_name = session_name();
\nif (!isset($_POST[$session_name])) {
\n exit;
\n} else {
\n session_id($_POST[$session_name]);
\n session_start();
\n}\n<\/p><\/blockquote>\n

\u5b9e\u6d4b\u53d1\u73b0\u65e0\u6cd5\u5c06session id\u4f20\u9012\u8fc7\u6765\uff0c\u63a8\u6d4b\u5e94\u8be5\u662f\u5728 session_id($_POST[$session_name]); \u4e4b\u524dThinkPHP\u6846\u67b6\u4e4b\u5df2\u7ecf\u6267\u884c\u8fc7session_id()\u521d\u59cb\u5316\u64cd\u4f5c
\n\u5c06\u5b98\u65b9\u65b9\u6848\u6539\u8fdb\u4e00\u4e0b\u5c31\u53ef\u4ee5\u594f\u6548<\/p>\n

\u670d\u52a1\u7aef<\/strong>
\n$session_name = session_name();
\nif (!isset($_POST[$session_name])){
\nexit;
\n}
\nelse{
\nsession_destroy(); \/\/\u9500\u6bc1\u4f1a\u8bdd\u4e2d\u7684\u5168\u90e8\u6570\u636e<\/strong>
\nsession_id($_POST[$session_name]); \/\/\u8bbe\u7f6e\u5f53\u524d\u4f1a\u8bdd\u7684ID\u4e3a\u524d\u7aef\u9875\u9762\u4f20\u9012\u8fc7\u6765\u7684session id
\nsession_start();
\n}<\/p><\/blockquote>\n

\u7c7b\u4f3c\u5176\u4ed6\u4f7f\u7528flash\u7684\u4e0a\u4f20\u63d2\u4ef6\u5e94\u8be5\u4e5f\u5b58\u5728\u76f8\u540c\u7684\u95ee\u9898\u53ef\u4ee5\u4f9d\u6b64\u65b9\u6848\u89e3\u51b3\u3002<\/p>\n

\u53c2\u8003\u8d44\u6599:<\/p>\n

http:\/\/www.uploadify.com\/documentation\/uploadify\/using-sessions-with-uploadify\/
\nhttp:\/\/www.thinkphp.cn\/topic\/4140.html<\/p>\n","protected":false},"excerpt":{"rendered":"

\u5728ThinkPHP\u5728\u4f7f\u7528Uploadify\u6216\u5176\u4ed6\u57fa\u4e8eFlash\u7684\u4e0a\u4f20\u63d2\u4ef6\u7684\u65f6\u5019\u5f88\u591a\u4eba\u4f1a\u78b0\u5230\u4e0a\u4f20\u63a7\u4ef6\u65e0\u6cd5\u4f20\u9012Se […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[9,6],"tags":[128,129,126,127],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1649"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1649"}],"version-history":[{"count":6,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1649\/revisions"}],"predecessor-version":[{"id":1655,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1649\/revisions\/1655"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1649"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}