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 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动