Derek Jones | 8ede1a2 | 2011-10-05 13:34:52 -0500 | [diff] [blame] | 1 | ########### |
| 2 | Path Helper |
| 3 | ########### |
| 4 | |
| 5 | The Path Helper file contains functions that permits you to work with |
| 6 | file paths on the server. |
| 7 | |
| 8 | .. contents:: Page Contents |
| 9 | |
| 10 | Loading this Helper |
| 11 | =================== |
| 12 | |
| 13 | This helper is loaded using the following code |
| 14 | |
| 15 | :: |
| 16 | |
| 17 | $this->load->helper('path'); |
| 18 | |
| 19 | The following functions are available: |
| 20 | |
| 21 | set_realpath() |
| 22 | ============== |
| 23 | |
| 24 | Checks to see if the path exists. This function will return a server |
| 25 | path without symbolic links or relative directory structures. An |
| 26 | optional second argument will cause an error to be triggered if the path |
| 27 | cannot be resolved. |
| 28 | |
| 29 | :: |
| 30 | |
| 31 | $directory = '/etc/passwd'; |
| 32 | echo set_realpath($directory); // returns "/etc/passwd" |
| 33 | $non_existent_directory = '/path/to/nowhere'; |
| 34 | echo set_realpath($non_existent_directory, TRUE); // returns an error, as the path could not be resolved |
| 35 | echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere" |
| 36 | |
| 37 | |