/** * generates URL like 'controller.php?action=action¶m1=value... * * @param string * @param string * @param array * @param string $fragment Fragment to be placed after a hash mark # * @return string */ public static function url($controller_name, $action_name = null, $args = array(), $fragment = '') { $url = Req::web_root() . '/' . $controller_name . '.php'; if ($action_name) { $args['action'] = $action_name; } if ($args) { $url .= '?' . Req::query_string($args); } if (!empty($fragment)) { $url .= Req::query_fragment($fragment); } return $url; }