Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SEO友好链接,js和/或php剥离_Php_Javascript_Url_Seo - Fatal编程技术网

SEO友好链接,js和/或php剥离

SEO友好链接,js和/或php剥离,php,javascript,url,seo,Php,Javascript,Url,Seo,我在wordpress上看到过这种情况,但我没有访问wordpress的权限: 但我需要返回一个url字符串,从中删除任何无效字符,并将一些字符转换为适当的字符: e、 g 并删除etccc中常见和无意义的单词,如a 如果您没有gd代码,请至少为我指出正确的方向:strtr可用于此: $replace = array( ' ' => '-', '_' => '-', 'the' => '', ... ); $string = strtr($string

我在wordpress上看到过这种情况,但我没有访问wordpress的权限:

但我需要返回一个url字符串,从中删除任何无效字符,并将一些字符转换为适当的字符:

e、 g

并删除etccc中常见和无意义的单词,如a

如果您没有gd代码,请至少为我指出正确的方向:

strtr可用于此:

$replace = array(
   ' ' => '-',
   '_' => '-',
   'the' => '',
   ...
);

$string = strtr($string, $replace);
strtr可用于以下用途:

$replace = array(
   ' ' => '-',
   '_' => '-',
   'the' => '',
   ...
);

$string = strtr($string, $replace);

我将使用str_replace函数创建一个函数。例如:

$str = 'Sentence with some words';
$str = strtolower($str);

$searchNone = array('the', 'a', 'in');
$replaceNone = '';

$str = str_replace($searchNone, $replaceNone, $str);

$search = array(chr(32)); //use ascii
$replace = '-';    

$str = str_replace($search, $replace, $str);

echo $str;

为特殊字符使用以下站点:。

我将使用str\u replace函数创建一个函数。例如:

$str = 'Sentence with some words';
$str = strtolower($str);

$searchNone = array('the', 'a', 'in');
$replaceNone = '';

$str = str_replace($searchNone, $replaceNone, $str);

$search = array(chr(32)); //use ascii
$replace = '-';    

$str = str_replace($search, $replace, $str);

echo $str;

为特殊字符使用以下站点:。

您需要的是段塞字符串。以下是相关链接的列表:


更多示例,请点击google PHP slug。

您需要的是段塞字符串。以下是相关链接的列表:

只需谷歌PHP slug即可获得更多示例。

可能类似于:

function PrettyUri($theUri)
{
    $aToBeReplace = array(' then ', ' the ', ' an '
    , ' a ', ' is ', ' are ', ' ', '_');
    $aReplacements = array(' ', ' ', ' '
    , ' ', ' ', ' ', '-', '-');
    return str_replace($aToBeReplace, $aReplacements, strtolower($theUri));
}


echo  PrettyUri('Hello WORLD this is a bad string');
可能是这样的:

function PrettyUri($theUri)
{
    $aToBeReplace = array(' then ', ' the ', ' an '
    , ' a ', ' is ', ' are ', ' ', '_');
    $aReplacements = array(' ', ' ', ' '
    , ' ', ' ', ' ', '-', '-');
    return str_replace($aToBeReplace, $aReplacements, strtolower($theUri));
}


echo  PrettyUri('Hello WORLD this is a bad string');

+我一读就想起了我在找什么lol:另一件事是这对多语言有任何支持吗?+1读就想起了我在找什么lol:另一件事是这对多语言有任何支持吗?