laravel ueditor Ó÷¨
laravel ÊÇÒ»¿îÖøÃûµÄ php ¿ª·¢¿ò¼Ü£¬ÔÚ¿ª·¢Àú³ÌÖУ¬¾³£ÐèҪʹÓø»Îı¾±à¼Æ÷À´±à¼ÄÚÈÝ¡£ueditor ÊÇÒ»¿î¹¦Ð§Ç¿Ê¢µÄ¸»Îı¾±à¼Æ÷£¬ËüÖ§³Ö¶àÖÖÓïÑÔºÍä¯ÀÀÆ÷£¬¿ÉÒÔÖª×ã´ó´ó¶¼µÄ±à¼ÐèÇó¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚ laravel ÖÐʹÓà ueditor¡£
Ò»¡¢×°ÖÃ UEditor
µÚÒ»²½£¬×°Öà UEditor¡£¿ÉÒÔÖ±½Ó´Ó¹ÙÍø£¨http://ueditor.www.zuhaoqu.com/website/download.html£©ÏÂÔØ UEditor µÄ×îа汾¡£½«ÏÂÔØµÄ zip °ü½âѹºó£¬½«½âѹºóµÄÎļþ¼Ð¸´ÖƵ½ Laravel ÏîÄ¿µÄ public Ŀ¼ÏÂÃæ¡£
µÚ¶þ²½£¬ÉèÖà UEditor¡£UEditor µÄÉèÖÃÎļþÊÇ·ÅÔÚ config.json ÎļþÖеģ¬ÔÚ Laravel ÏîÄ¿ÖУ¬ÐèÒª½«¸ÃÎļþ·ÅÔÚ public/ueditor Ŀ¼ÏÂÃæ¡£ÉèÖÃÎļþÖаüÀ¨ÁËÐí¶à²ÎÊý£¬¿ª·¢Õß¿ÉÒÔƾ֤×Ô¼ºµÄÐèÇó¾ÙÐÐÉèÖã¬ÉèÖÃÎļþµÄ²ÎÊý˵Ã÷¼û UEditor ¹Ù·½Îĵµ£¨http://fex.www.zuhaoqu.com/ueditor/#server-config_1£©¡£
¶þ¡¢ÔÚ Laravel ÖÐʹÓà UEditor
µÚÒ»²½£¬ÒýÈë UEditor µÄÑùʽºÍ JavaScript Îļþ¡£ÔÚ Laravel µÄ Blade Ä£°åÖУ¬¿ÉÒÔʹÓÃÈçÏ´úÂëÀ´ÒýÈ룺
<link rel="stylesheet" type="text/css" href="/ueditor/themes/default/css/ueditor.min.css"> <script type="text/javascript" src="/ueditor/ueditor.config.js"></script> <script type="text/javascript" src="/ueditor/ueditor.all.min.js"></script>
µÇ¼ºó¸´ÖÆ
ÕâÀïÐèҪעÖصÄÊÇ£¬ÐèҪƾ֤ UEditor µÄ×°Ö÷¾¶À´ÉèÖÃÑùʽºÍ JavaScript µÄÎļþ·¾¶¡£
µÚ¶þ²½£¬ÔÚ±íµ¥ÖÐÌí¼Ó UEditor µÄ±à¼Æ÷¡£ÔÚ Laravel µÄ Blade Ä£°åÖУ¬¿ÉÒÔʹÓÃÈçÏ´úÂëÀ´Ìí¼ÓÒ»¸ö UEditor µÄ±à¼Æ÷£º
<script id="editor" type="text/plain"></script>
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬id ÊôÐÔ¿ÉÒÔ×Ô¼º½ç˵£¬type ÊôÐÔ±ØÐèΪ text/plain¡£¸Ã´úÂë»áÔÚÒ³ÃæÖн¨ÉèÒ»¸ö¿ÕµÄ±à¼Æ÷£¬Ê¹Óà JavaScript ´úÂë³õʼ»¯±à¼Æ÷¡£
µÚÈý²½£¬³õʼ»¯ UEditor ±à¼Æ÷¡£ÔÚ Laravel µÄ Blade Ä£°åÖУ¬¿ÉÒÔʹÓÃÈçÏ JavaScript ´úÂëÀ´³õʼ»¯ UEditor ±à¼Æ÷£º
<script type="text/javascript"> var editor = UE.getEditor('editor'); </script>
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬’editor’ ÊÇÉÏÒ»²½Öнç˵µÄ±à¼Æ÷µÄ id¡£
Èý¡¢ÉúÑÄ UEditor µÄÄÚÈÝ
UEditor µÄÄÚÈÝÉúÑÄÔÚÒ»¸ö HTML Îı¾ÖУ¬Òò´Ë²»ÐèÒª¾ÙÐÐÌØÊâ´¦Àí¡£ÔÚ Laravel ÖУ¬¿ÉÒÔʹÓÃÈçÏ´úÂë»ñÈ¡ UEditor µÄÄÚÈÝ£º
$content = $request->input('content');
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬$request ÌåÏÖ¶ÔÄ¿½ñÇëÇóµÄ·â×°£¬¿ÉÒÔʹÓÃËüÀ´»ñÈ¡±íµ¥ÖеÄÊý¾Ý¡£ÈôÊÇÐèÒª½« UEditor µÄÄÚÈÝÉúÑĵ½Êý¾Ý¿âÖУ¬Ö±½Ó½« $content ´æÈëÊý¾Ý¿â¼´¿É¡£
ËÄ¡¢ÆäËû
UEditor »¹Ö§³ÖͼƬ¡¢ÊÓƵ¡¢ÎļþµÈÉÏ´«¹¦Ð§£¬¿ª·¢Õß¿ÉÒÔƾ֤×Ô¼ºµÄÐèÇó¾ÙÐÐÉèÖúÍʹÓã¬ÏêϸµÄʹÓÃÎĵµ¼û UEditor ¹Ù·½Îĵµ£¨http://fex.www.zuhaoqu.com/ueditor/#server-config_1£©¡£
×ܵÄÀ´Ëµ£¬ÔÚ Laravel ÖÐʹÓà UEditor ±à¼Æ÷ºÜÊǼòÆÓ£¬Ö»ÐèÒªÏÂÔØ UEditor£¬ÉèÖÃÏà¹Ø²ÎÊý£¬È»ºóÔÚ Blade Ä£°åÖÐÒýÈëÑùʽºÍ JavaScript Îļþ£¬¼´¿ÉÔÚ±íµ¥ÖÐÌí¼Ó UEditor ±à¼Æ÷¡£Í¬Ê±£¬UEditor »¹Ö§³Ö¸»ºñµÄ¹¦Ð§ºÍÉèÖã¬ÉÁ¿ª·¢Õß¿ÉÒÔÎÞаµØƾ֤×Ô¼ºµÄÐèÇó¾ÙÐÐʹÓúͶ¨ÖÆ¡£
ÒÔÉϾÍÊÇlaravel ueditor Ó÷¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡