Code: Select all
[em=yocie002]
Code: Select all
<img border='0' src='/pic/yocie/yocie002.gif' title='yocie002'>"
แระก็ yocie มาเป็นชื่อ folder
แระก็ yocie002 มาเป็น title กับ ชื่อรูป แล้วเพิ่ม .gif เข้าไป
ตรง ] ก็เปลี่ยนเป็น >
หาตัวอย่าง code มาได้แต่อ่านแล้วงงมาก ยิ่งมันต่อเนื่องไปเรื่อง regular expression ยิ่งงงหนักเข้าไปอีก
อย่างตรงนี้
Code: Select all
$s = "[img=https://www.mindphp.com/forums/images/smilies/icon_idea.gif]";
$s = preg_replace("/\[img=(http:\/\/[^\s'\"<>]+(\.(gif|jpg|png)))\]/i", "<img border=\"0\" src=\"\\1\" alt='' />", $s);
Code: Select all
<img src="https://www.mindphp.com/forums/images/smilies/icon_idea.gif">
ตอนนี้ทำแบบนี้ก็ยังไม่ออกมาเป็นแบบที่ต้องการ
Code: Select all
$s = preg_replace("/\[em=([^\s'\"<>])/", "\\1\.gif" , $s);
รบกวนหน่อยครับ


