我打算获取一个txt文件的内容,我使用的是Codeigner框架。我把url.txt的内容放在根文件夹中。
$link_univ = 'http://localhost/perpus3/index.php/webService/wsdl';
$link_mipa = 'http://localhost/perpus_mipa/index.php/webService/wsdl';
在文件夹控制器中,我有Koleksi.php,我创建了一个函数来获取url.txt 的内容
$lines = file('url.txt');
foreach ($lines as $line_num => $line){
print $line. "<br />n";
}
您应该签出文件助手。它会为你做这一切的。示例:
$this->load->helper('file');
$string = read_file('./path/to/file.php');
现在$string变量应该有file.php中的文本。