我正在创建URL表单我的已发布标题。这是一些示例标题。
$title = "Global Campaign Manager - (SEO and Advertising)";
$title = "Broadcast Journalist, BBC News Online (London)";
$title = "Agile Digital Project Manager/£475 - 525 pd/6 months/London";
现在,这是我希望形成此标题的URL示例。
www.example.com/global_campaign_manager_-_seo_and_advertising
www.example.com/agile_digital_project_manager475_-_525_pd6_monthslondon
www.example.com/broadcast_journalist_bbc_news_online_london
答案 0 :(得分:2)
要将任何标题或文字转换为网址codeigniter,请设置URL Helper
使用以下代码加载此帮助程序:
$this->load->helper('url');
现在,将字符串转换为正确的URL。用户url_title
$title = "Agile Digital Project Manager/£475 - 525 pd/6 months/London";
$url_title = url_title($title, 'underscore');
www.example.com/agile_digital_project_manager475 _-_ 525_pd6_monthslondon