0
我想从浏览器中运行的网址,让位于我的项目的文件内容,例如:/home/fessy/file.txt
无法从URL调用方法,笨
我用笨和学说。
我有一个方法:
class Api extends REST_Controller {
// ....
public function get_file_content_get(){
var_dump(array('ftp_path' => $this->uri->segments));
$name = $this->uri->segment(3);
$rootPath = $this->uri->segment(4);
$file = file_get_contents("$rootPath/$name.txt", FILE_USE_INCLUDE_PATH);
// $this->_response('success', array('file_contents' => $file));
}
于是我产生了自己的网址为:
site.com/index.php/api/get_file_content_get/118130/%2Fhome%2Ffessy%2Ffile.txt
但我得到一个错误:
<xml>
<status/>
<error>Unknown method.</error>
</xml>
当我改变超类从REST_Controller
至CI_Controller
我成功拨打get_file_content_get
的方法。
我事件不能得到site.com/index.php/api/get_file_content_get/
调用index()
我做错了什么?
感谢,