%22(双引号)添加到URL的任何地方 [英] %22 (double quotes) added to url out of nowhere

查看:375
本文介绍了%22(双引号)添加到URL的任何地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个邮件程序,该邮件程序将用于将新闻邮件邮寄给客户,其中的新闻邮件中将包含图片和链接.当我在localhost上对其进行测试时,一切正常,链接也正常工作.但是,当我将其上传到我的网站时,链接和图像路径将不再起作用.

I'm making a mail programm that wil be used to mail newsletters to customers, in the newsletters will be images and links. When I tested it on localhost everything worked fine and the links worked. However when I uploaded it to my website the links and image paths won't work anymore.

由于某种原因,它在链接和路径中添加了%22(我发现它是双引号),因此我邮寄的链接看起来像这样:

For some reason it adds %22 (which I found out are double quotes ") to the links and paths so the link I mailed looks like this:

/%22http//www.mywebsite.com/%22

图像路径如下:

%22http//www.mywebsite.com/content/someimage.jpg/%22

我正在使用TinyMCE编辑时事通讯,并且尝试了relative_urls : falseconvert_urls : false,但这无济于事.我不认为这是TinyMCE的问题,但我还是想提一提.

I'm using TinyMCE to edit the newsletter and I've tried relative_urls : false and convert_urls : false but that does nothing. I don't think this is a TinyMCE issue but I thought I'd mention it anyway.

我不知道是什么原因造成的,所以如果有人知道会发生什么,那就太好了!

I have no clue what is causing this so if anyone knows what it going on it would be great!

更新: 我已经检查了我的代码,并查看了邮件中发送的文本的html,并且该链接在任何时间都没有双引号,因此我猜测这是服务器问题.

Update: I've checked my code and looked at the html of the text being send in the mail and there are no double quotes around the link at any time so my guess is that it is a server issue.

推荐答案

这是magic_quotes的问题,请检查您的phpinfo()以查看其是否已关闭.如果您能够将其关闭,则必须在php.ini中将其禁用.

This is a problem with magic_quotes Check your phpinfo() to see if it is turned off. If you are able to turn it off You have to disable it in your php.ini.

您可以使用以下代码测试它是启用还是禁用:

You can test if it's enabled or disabled with the following code:

<?php
echo "Magic quotes is ";
if (get_magic_quotes_gpc()) {
  echo "enabled.";
} else {
  echo "disabled";
}
?>

另一种解决方法是使用stripslashes()删除斜杠.这很可能会解决问题.

Another fix could be to use stripslashes() to remove the slashes. This most likely will solve the problem.

阅读有关stripslashes() 此处

一个简单的例子:

<?php
$str = "Is your name O\'reilly?";

// Outputs: Is your name O'reilly?
echo stripslashes($str);
?>

您可以尝试的另一种方法是使用html_entity_encode().

another thing you can try is to use html_entity_encode().

一个例子:

<?php
$orig = "I'll \"walk\" the <b>dog</b> now";

$a = htmlentities($orig);

$b = html_entity_decode($a);

echo $a; // I'll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now

echo $b; // I'll "walk" the <b>dog</b> now
?>

info 这里

另一个答案.网址中的html_entity_encode() https://stackoverflow.com/a/10001006/1379394

Another SO answer. for html_entity_encode() in urls https://stackoverflow.com/a/10001006/1379394

这篇关于%22(双引号)添加到URL的任何地方的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆