蔭限制在字符串中的字符數:我如何使用這個腳本用mysql
$thisproductname_url=str_replace(" ", "-", $r["name"]); // replace a space with hyphen
$thisproductname_url = preg_replace("/[^0-9a-zA-Z-]/", '', $thisproductname_url);
但在變量$ thisproductname_url chracters的數量有時會過多(240+),並打破了鏈接。
有沒有辦法限制變量 - $ thisproductname_url - 要說200個字符?
由於原始字符串是用戶輸入,那麼限制用戶可以輸入的長度是什麼? – marekful