简体   繁体   English

PHP URL 编码问题

[英]PHP URL encoding issues

I am working in wordpress and i have to set external products link which contains title as parameter to woocommerce product.我在 wordpress 工作,我必须设置外部产品链接,其中包含标题作为 woocommerce 产品的参数。 all of the task is done but product title containts French words(â, ê, î, ô, û) so url is generating in wrong manner.所有任务都已完成,但产品标题包含法语单词(â、ê、î、ô、û),因此 url 以错误的方式生成。

Issue : http://antiqbook.com/search.php?action=search&owner_id=cab&title=Prom%C3%A9th%C3%A9e+et+Epim%C3%A9th%C3%A9e.问题http : //antiqbook.com/search.php?action=search&owner_id=cab&title=Prom%C3%A9th%C3%A9e​​+et+Epim%C3%A9th%C3%A9e​​。

need : http://antiqbook.com/search.php?action=search&owner_id=cab&title=Prom%E9th%E9e+et+Epim%E9th%E9e . 需要http : //antiqbook.com/search.php?action=search&owner_id=cab&title=Prom%E9th%E9e+et+Epim%E9th%E9e

<?php    
    $url = "http://antiqbook.com/search.php? action=search&owner_id=cab&title=";
    $encodeUrl = urlencode("Prom%C3%A9th%C3%A9e+et+Epim%C3%A9th%C3%A9e.");
    $url .= $encodeUrl;
    echo $url; 
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM