2012-01-12 97 views
0

我遇到了一些问题,不知道如何解决此问题,并且它一直在困扰我好几天。ImageString中使用的文本/符号无法正确显示

我有一个脚本,可以制作出移民海报。
(例如:http://www.motifake.com/image/demotivational-poster/0901/hey-beetlejuice-doris-joker-funny-demotivational-poster-1231432214.jpg

我面对的问题是相同的符号,输入的文字:!@£$%^ * &(),.〜”

他们从来没有展示,或回来不同的符号,他们应该是什么,像\\\''\

我没有专门的格式使用代码的方法是如下: 这是文本输入框: 动机文字:<input type="text" name="motivationaltext">

在我的PHP文件我用:

$motivationaltext = $_POST['motivationaltext'];  

,后来我用这个图像串:

CenterImageString($im, $width, $motivationaltext, 16, ($top + $imgy + 74), $text_color);  

有没有人对如何去吨的想法他?

+0

你能张贴你的脚本?我推测你使用Dirkjan发布的代码片段中的代码 - http://www.php.net/manual/en/function.imagestring.php#94306 - 我只是用他的函数和那些符号进行了一个快速测试打开罚款.... – Aesphere 2012-01-12 09:47:09

+0

mess-hall.co.uk/Mivivator/motivational.zip是脚本的位置,并且http://mess-hall.co.uk/Motivator/test2.php它工作,但问题与符号 谢谢 – user1145101 2012-01-12 11:21:21

回答

0

在你的php.ini文件中,设置magic_quotes_gpc = Off。这应该照顾额外的\

替代的解决方案:如果设置上,你不能(或不愿)将其关闭,使用stripslashes()功能:

$motivationaltext = stripslashes($_POST['motivationaltext']); 
+0

谢谢:)完美 – user1145101 2012-01-12 13:42:17

相关问题