3 回答

TA貢獻(xiàn)1830條經(jīng)驗 獲得超3個贊
您可以簡單地使用explode()您的字符串|
作為分隔符:
<?php
$urls = explode("|", $_POST['IMG']);
echo $urls[0]; // url.com/img1.png
echo $url[1]; // url.com/img2.png
echo $url[2]; // url.com/img3.png

TA貢獻(xiàn)1744條經(jīng)驗 獲得超4個贊
我認(rèn)為有一種方法是先檢查 POST 變量 IMG 是否存在。然后使用 PHP Explode() 函數(shù)分解其內(nèi)容。
$image_urls = array(); //blank array assuming there are no image URLs
if(isset($_POST['IMG']))
{
$image_urls = explode('|', $_POST['IMG']);
}
//Below code will check if the array actually has image URL parts from
//POST variable IMG
if(count($image_urls) > 0)
{
//your code to process the images
}
- 3 回答
- 0 關(guān)注
- 137 瀏覽
添加回答
舉報