zend框架表单输入在服务器上无法正常工作

时间:2014-03-24 06:12:05

标签: php mysql zend-framework

我正在使用zend framework 1.12
表格中有一个文字区域 我在这个文本区域名称='内容'

中写下html
<p>
<img width="100" height="63" alt="" src="/public/images/image/roses-bush-wallpaper-dsc03633.jpg" />
</p>

表单提交后,我在$ _POST [&#39;内容]

下面
<p>
<img width="\&quot;100\&quot;" height="\&quot;63\&quot;" alt="\&quot;\&quot;" src="\&quot;/public/images/image/roses-bush-wallpaper-dsc03633.jpg\&quot;" />
</p>

这个html编码对我来说不是必需的。

主要问题是我在服务器上遇到问题只在我的localhost中工作正常。在localhost中,我在textarea中输入的内容相同。

以下是zenform元素

$content = new Zend_Form_Element_Textarea('content');
$content->setLabel('content')
    ->setAttrib('rows', 12)
    ->setAttrib('cols', 40)
    ->setRequired(true)
    ->addFilter('StringTrim')
     ->setDecorators(array('ViewHelper','Errors'));

2 个答案:

答案 0 :(得分:0)

您的服务器上有“magic-quotes-gpc = on”。请查看以下页面,了解如何禁用它:

http://www.php.net/manual/en/security.magicquotes.disabling.php

答案 1 :(得分:0)

在您的服务器上启用magic_quotes_gpc 您可以尝试以下任何一项来禁用它。

  1. 您可以添加htaccess cile

    php_flag magic_quotes_gpc off

  2. 在根目录下创建一个php.ini文件。 将此内容添加到文件并保存

    magic_quotes_gpc =关闭 magic_quotes_runtime =关闭 magic_quotes_sybase =关

    编辑.htaccess文件并在顶部添加此行并保存文件

    SetEnv PHPRC /home/youruser/public_html/php.ini

  3. 在php文件的顶部添加以下功能

    ini_set(&#39; magic_quotes_gpc&#39;,0);

  4. 如果不从php配置中禁用魔术代码,您可以修改代码,如下所示

    $ _ POST = array_map(&#39; stripslashes&#39;,$ _POST);