doumu4032 2017-11-10 14:55
浏览 55
已采纳

在localhost上更正html标签,但在web甚至相同的PHP代码和数据库中进行了清理

I'm trying to figure out a strange issue I stumbled on:

Locally and on external server I use the same web environment thanks to Ansible and Vagrant.

I use Ubuntu, Apache Webserver, MySQL, PHP 7, Codeigniter 3.

On the edit form I see on localhost correct HTML tags.

localhost

But when I open the same page from the cloud (an external Webserver) the HTML tags are sanitized on Chrome and Firefox.

enter image description here

What's the cause of this behaviour and how can I prevent the sanitized html tags?

  • 写回答

1条回答 默认 最新

  • doushun4666 2017-11-10 16:36
    关注

    If you haven't bothered to set CI_ENV correctly in either your configuration file application/config/config.php or via apache (either in .htaccess or apache conf) then you might get different behavior on the two different machines.

    You should also check application/config/config.php for this value and see what it's set to:

    $config['global_xss_filtering'] = FALSE;
    

    Obviously, if you've bothered to define different config.php values in these locations, you may need to check them also:

    application/config/development/config.php
    application/config/testing/config.php
    application/config/production/config.php
    

    As a sanity check, you might want to define a controller method like this and see if it outputs different values on your respective machines:

    public function ci_check() {
        echo CI_ENV;
    }
    

    If you find that the machines have different CI_ENV values, it may be that each machine is loading a different configuration file for config value global_xss_filtering. This might cause the problem you are seeing. Sort of hard to say without seeing more code.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM