subString by a string in PHP -
$element['path'] = "c:\xampp\htdocs\intellikid\public\assets\uploads\123.mp4"; as laravel 5 doesn't allow access local files, need substring above file path assests folder end.
expected output assets\uploads\123.mp4
also want take format string.
expected output .mp4
just replace document root:
$path = str_replace($_server['document_root'], '', $element['path']); pathinfo() can extension:
$ext = pathinfo($path, pathinfo_extension); or use strstr() , strrchr():
$path = strstr($element['path'], 'assets'); $ext = strrchr($element['path'], '.'); though use pathinfo() extension.
Comments
Post a Comment