Tag: cakephp 1.2

您将对包含一些特殊字符的URL执行什么操作

我正在使用cakePHP 1.26 我有一个输入文本框,其中包含一个URL,我想提交URL并使用Jquery AJAX将其存储在数据库中。 这是HTML部分: 这是JQuery的一部分: var whatContent=$(“#testing”).val(); var curl=”http://localhost:8080/test/grab/”+whatContent; $.ajax({ type: “POST”, url: curl, success: function(data) { alert(data);} }); 这是Controller中Action的代码: function grab($w=null){ if($w!=null){ return $w; } } 代码工作,我可以看到警告消息弹出,但它显示: https : //stackoverflow.com/ 代替 https://stackoverflow.com/questions/ask 我尝试过使用escape(whatContent)和encodeURI(whatContent),但是他们无法帮助, 警报框仍然显示我https://stackoverflow.com/ 代替 https://stackoverflow.com/questions/ask 我不知道如何处理包含一些特殊字符的URL数据。