Helpers\URL
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
最新文章
- C# 系统错误日志处理类
- 并发编程中.net与java的一些对比
- 经典的Java基础面试题集锦
- 【leetcode】Reverse Linked List II (middle)
- Async/Await 最佳实践
- CUDA入门1
- Careercup - Google面试题 - 5765091433644032
- shell 运算
- linux ubuntu vsftp 默认主目录
- [Learn Android Studio 汉化教程]第三章:使用 Android Studio 编程
- CentOS 6.3 安装ATI显卡驱动
- phpcms9添加301跳转
- Virtual Friends(并查集+map)
- 10、end关键字和Fibonacci series: 斐波纳契数列
- google搜索指南
- ES6 Promise 详解
- jmeter正则表达式提取器提取特定字符串后的全部内容
- 【转】彻底搞清C#中cookie的内容
- web.xml 详细介绍(zz)
- Linux上实现Windows的SQLPlus保存SQL历史记录功能
热门文章
- 我的EC-final总结
- 第二百三十八天 how can I 坚持
- HDU 5839 Special Tetrahedron (计算几何)
- Codeforces 599D Spongebob and Squares(数学)
- Codeforces Round #349 (Div. 2) D. World Tour (最短路)
- HDU2079选课时间(母函数)
- Call me, maybe?
- PL SQL Developer 使用总结
- 非IE内核浏览器支持activex插件
- 【不积跬步,无以致千里】AMQP协议介绍