| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
FileSystem |
JPath |
clean |
clean() |
Never | Work in Progress |
This method strips additional / or \ in a path name. It can also add a trailing slash if desired. It will also change the slashes to the system appropriate folder separator (eg. \ on Microsoft Windows systems, but / on Unix systems).
string clean ( $p_path, $p_addtrailingslash )
| $p_path | string | is a string containing the path to clean. |
| $p_addtrailingslash | boolean | is a flag which specifies whether the method should add a trailing slash. This parameter is optional and if omitted defaults to true. |
Example
jimport( 'joomla.filesystem.path' ); echo "Cleaned path: " . JPath::clean( '//..//..//..\\test.html' );
might produce:
Result
Cleaned path: \..\..\..\test.html\