Welcome Guest, Not a member yet? Register   Sign In
URI changes . to _ (best practice?)
#6

[eluser]Unknown[/eluser]
This is a real problem and I faced it on WAMP. I needed file names to be an argument for some of my controller methods, but the extensions always turned from ".jpg" to "_jpg".
solution:
Code:
function view($filename)
{
       $parts = explode("_",$filename);
       $ext   = array_pop($parts);
       $file =  implode("_",$parts).".".$ext;
       echo $file;
}
/*Example
* request url: http://example.com/welcome/view/this_is_a_test.jpg
*
* OUTPUT: this_is_a_test.jpg
*
* location: "./application/controllers/welcome.php"
*
*/

Example:


Messages In This Thread
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 08:32 AM
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 09:56 AM
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 10:41 AM
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 11:20 AM
URI changes . to _ (best practice?) - by El Forum - 08-23-2010, 07:52 PM
URI changes . to _ (best practice?) - by El Forum - 01-18-2011, 01:38 PM
URI changes . to _ (best practice?) - by El Forum - 01-18-2011, 04:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB