|
|
|
ผมจะไปใช้ php 7 แต่ฟังค์ชั่นนี้ ใช้ไม่ได้แล้ว ผมจะใช้อะไรแทนครับ |
|
|
|
|
|
|
|
Code (PHP)
function slug($string)
{
return strtolower(trim(preg_replace('~[^0-9a-z]+~i', '-', html_entity_decode(preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8')), '-'));
}
function get_random($matches)
{
$rand = array_rand($split = explode("|", $matches[1]));
return $split[$rand];
}
function show_randomized($str)
{
$new_str = preg_replace_callback('/\{([^{}]*)\}/im', "get_random", $str);
if ($new_str !== $str)
$str = show_randomized($new_str);
return $str;
}
Tag : PHP
|
|
|
|
|
|
Date :
2017-03-04 09:51:05 |
By :
kantithad |
View :
995 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันไหนครับ
|
|
|
|
|
Date :
2017-03-04 10:35:43 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|