Home >php教程 >PHP源码 >PHP 的 SEO优化方法-URL优化

PHP 的 SEO优化方法-URL优化

PHP中文网
PHP中文网Original
2016-05-25 17:13:551931browse

PHP 的 SEO优化方法-URL优化

在处理地址URL时,用这个函数可以轻松就把单词用"-"连起来

function getSeoVersion($phrase) {
  return preg_replace('/[^a-z0-9_-]/i', '', strtolower(str_replace(' ', '-', trim($phrase))));
}
  
// example usage:
echo getSeoVersion("German cars are amazing.");

以上就是PHP 的 SEO优化方法-URL优化的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP 计算加权(简单易用)Next article:PHP生成友好URL