Skip to content

Instantly share code, notes, and snippets.

@victorono
Created July 7, 2014 02:07
Show Gist options
  • Select an option

  • Save victorono/db818012131c488fcaf9 to your computer and use it in GitHub Desktop.

Select an option

Save victorono/db818012131c488fcaf9 to your computer and use it in GitHub Desktop.
Add Trailing Slash to CakePHP
<?php
class AppHelper extends Helper {
function url($url = null, $full = false) {
$routerUrl = Router::url($url, $full);
if (!preg_match('/\\.(rss|html|js|css|jpeg|jpg|gif|png|xml?)$/', strtolower($routerUrl)) && substr($routerUrl, -1) != '/') {
$routerUrl .= '/';
}
return $routerUrl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment