非常教程

Codeigniter 3参考手册

路径 | Path

路径助手 | Path Helper

PATH Helper文件包含允许您在服务器上使用文件路径的函数。

  • 加载此助手
  • 可用职能

加载此助手

使用以下代码加载此助手:

$this->load->helper('path');

可用职能

现有下列职能:

set_realpath($path[, $check_existance = FALSE])

参数:

$ path(string) - Path $ check_existance(bool) - 是否检查路径是否真实存在

返回:

绝对路径

返回类型:

  • $ pathstring) - 路径
  • $ check_existancebool) - 是否检查路径是否存在
Returns:  An absolute path
Return type:  string
该函数将返回没有符号链接或相对目录结构的服务器路径。如果路径无法解析,则可选的第二个参数将导致触发错误。

例子:

$ file ='/etc/php5/apache2/php.ini'; echo set_realpath($ file); //打印'/etc/php5/apache2/php.ini'$ non_existent_file ='/path/to/non-exist-file.txt'; echo set_realpath($ non_existent_file,TRUE); //显示错误,因为无法解析路径echo set_realpath($ non_existent_file,FALSE); //打印'/path/to/non-exist-file.txt'$ directory ='/ etc / php5'; echo set_realpath($ directory); //打印'/ etc / php5 /'$ non_existent_directory ='/ path / to / nowhere'; echo set_realpath($ non_existent_directory,TRUE); //显示错误,因为无法解析路径echo set_realpath($ non_existent_directory,FALSE); //打印'/ path / to / nowhere'

路径 | Path相关

Codeigniter 3

CodeIgniter 是一个PHP MVC框架,特点是超轻量级、有数据加密、有灵活URI路由等。对于 PHP 程序员来说,它小巧但功能强大。

主页 https://codeigniter.com/
源码 https://github.com/bcit-ci/CodeIgniter
版本 3
发布版本 3.1.5