|
楼主 |
发表于 2017-8-16 17:27:23
|
显示全部楼层
我在ci框架的根目录下新建了test.html文件,内容是:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type='text/javascript'>
function testJson(obj){
var aaa=obj.ip+obj.pro+obj.city+obj.region;
console.log(aaa);
}
</script>
<script src="http://whois.pconline.com.cn/ipJson.jsp?callback=testJson" charset="utf-8" type="text/javascript"></script>
</body>
</html>
又在controller下新建了一个控制器,内容:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Home extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.html/welcome
* - or -
* http://example.com/index.html/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.html/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function test(){
$this->load->view('home/test.html');
}
}
然后通过浏览器访问../index.php/home/test
出现错误提示:
403 Forbidden
You don't have permission to access the URL on this server. Sorry for the inconvenience.
Please report this message and include the following information to us.
Thank you very much!
URL: http://whois.pconline.com.cn:6060/ipJson.jsp?callback=testJson
Server: all-whois-vm230-47.pconline.cnc
Date: 2017/08/16 17:24:56
Powered by Tengine/2.1.2
但是我把 上面test.html文件不放在ci 框架下面,用浏览器打开就没有问题 |
|