Helpers\URL

The URL class is used for having handy methods or redirecting the page and returning the path to the current template.

Redirect - To redirect to another page instead of using a header call the static method redirect:

Url::redirect('path/to/go');

Previous - To be redirected back to the previous page:

Url::previous();

The redirect method can accept a 2nd option of true is used the path will be used as it is provided.

This is useful to redirect to an external website, by default the redirects are relative to the domain its on.

The url should be the local path excluding the application url for instance a valid case might be:

Url::redirect('contacts');

The redirect method uses the DIR constant to get the application address.

template_path has been renamed to templatePath

The next method is get_templatePath, this returns the path to the template relative from the templates folder, for instance by default it will return: http://www.example.com/templates/default/ this is useful for using absolute paths in your design files such as including css and js files.

Url::templatePath();

autolink has been renamed to autoLink

Another useful feature is the ability to scan a block of text look for any domain names then convert them into html links. To use the autoLink call url:: followed by the method name and pass in the string to autoLink:

$string = "A random piece of text that contains google.com a domain.";
echo Url::autoLink($string);

The autoLink method also accepts a 2nd parameter that will be used as the click text for instance a in the text above I want the link to say Google and not google.com.

$string = "A random piece of text that contains google.com a domain.";
echo Url::autoLink($string, 'Google');

When run the link word will be Google which will link to http://google.com

最新文章

  1. C# 系统错误日志处理类
  2. 并发编程中.net与java的一些对比
  3. 经典的Java基础面试题集锦
  4. 【leetcode】Reverse Linked List II (middle)
  5. Async/Await 最佳实践
  6. CUDA入门1
  7. Careercup - Google面试题 - 5765091433644032
  8. shell 运算
  9. linux ubuntu vsftp 默认主目录
  10. [Learn Android Studio 汉化教程]第三章:使用 Android Studio 编程
  11. CentOS 6.3 安装ATI显卡驱动
  12. phpcms9添加301跳转
  13. Virtual Friends(并查集+map)
  14. 10、end关键字和Fibonacci series: 斐波纳契数列
  15. google搜索指南
  16. ES6 Promise 详解
  17. jmeter正则表达式提取器提取特定字符串后的全部内容
  18. 【转】彻底搞清C#中cookie的内容
  19. web.xml 详细介绍(zz)
  20. Linux上实现Windows的SQLPlus保存SQL历史记录功能

热门文章

  1. 我的EC-final总结
  2. 第二百三十八天 how can I 坚持
  3. HDU 5839 Special Tetrahedron (计算几何)
  4. Codeforces 599D Spongebob and Squares(数学)
  5. Codeforces Round #349 (Div. 2) D. World Tour (最短路)
  6. HDU2079选课时间(母函数)
  7. Call me, maybe?
  8. PL SQL Developer 使用总结
  9. 非IE内核浏览器支持activex插件
  10. 【不积跬步,无以致千里】AMQP协议介绍