我有一个包含以下内容的 PHP 文件:
<script type="text/javascript" src="<?php echo base_url();?>js/example1.js"></script>
<script type="text/javascript">var base_url = '<?php echo @base_url(); ?>';</script>
........
<input type="hidden" id="testvpn" value="<?php echo base_url(); ?>js/example.js"/>
........
当我尝试在本地打开页面时,一切正常:
<script type="text/javascript" src="http://example.com/js/example1.js"></script>
<script type="text/javascript">var base_url = 'http://example.com/';</script>
........
<input type="hidden" id="testvpn" value="http://example.com/js/example.js"/>
........
当我尝试通过 web vpn 打开页面时,我想看到:
<script type="text/javascript" src="https://mywebvpn.com/+CSCO+numbers++/js/example1.js"></script>
<script type="text/javascript">var base_url = 'https://mywebvpn.com/+CSCO+numbers++/';</script>
........
<input type="hidden" id="testvpn" value="https://mywebvpn.com/+CSCO+numbers++/js/example.js"/>
........
但我得到:
<script type="text/javascript" src="https://mywebvpn.com/+CSCO+numbers++/js/example1.js"></script>
<script type="text/javascript">var base_url = 'http://example.com/';</script>
........
<input type="hidden" id="testvpn" value="http://example.com/js/example.js"/>
........
PS 框架 - 代码点火器。服务器端 - PHP、MYSQL、APACHE。
PPS 配置 webvpn 服务不是我的工作。会不会是 webvpn 的问题?
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .=str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);