目录 搜索
Array Array Helper Benchmarking Benchmarking Class Caching Caching Driver Calendaring Calendaring Class CAPTCHA CAPTCHA Helper Config Config Class Cookie Cookie Helper Database Connecting to your Database Custom Function Calls Database Caching Class Database Configuration Database Forge Class Database Metadata Database Quick Start: Example Code Database Reference Database Utility Class DB Driver Reference Generating Query Results Queries Query Builder Class Query Helper Methods Transactions Date Date Helper Directory Directory Helper Download Download Helper Email Email Class Email Helper Encrypt Encrypt Class Encryption Encryption Library File File Helper File Uploading File Uploading Class Form Form Helper Form Validation Form Validation FTP FTP Class Functions compatibility_functions common_functions HTML HTML Helper HTML Table HTML Table Class Image Manipulation Image Manipulation Class Inflector Inflector Helper Input Input Class Javascript Javascript Class Language Language Class Language Helper Loader Loader Class Migrations Migrations Class Number Number Helper Output Output Class Pagination Pagination Class Path Path Helper Security Security Class Security Helper Session Session Library Shopping Cart Shopping Cart Class Smiley Smiley Helper String String Helper Template Parser Template Parser Class Text Text Helper Trackback Trackback Class Typography Typography Class Typography Helper Unit Testing Unit Testing Class URI URL User Agent XML XML-RPC and XML-RPC Server Zip Encoding Zip Encoding Class XML-RPC and XML-RPC Server Classes XML Helper User Agent Class URL Helper URI Class
文字

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'

上一篇: 下一篇: