how to support UTF8 (japanese, arabic, spanish, …) URL's in PHP

前端 未结 4 951
既然无缘
既然无缘 2020-12-15 14:32

For a web application, we need to link to some user generated content. A users types in a title for e.g. a product and we generate an SEO friendly url for that product:

4条回答
  •  执念已碎
    2020-12-15 15:16

    You should do urlencode the Arabic or unicode text

    urlencode('كلام-عربي')
    

    And its very important to add the charset code to the head tag of the page, otherwise the link will not work

    
    

提交回复
热议问题