Yii2 关于 Url::toRoute 和Url::to 路径 例子
来源:互联网 发布:算法的乐趣代码 编辑:程序博客网 时间:2024/06/14 03:52
首先使用域名空间
use yii\helpers\Url;
Url::toRoute
// /index.php?r=site/indexecho Url::toRoute('site/index');// /index.php?r=site/index&src=ref1#nameecho Url::toRoute(['site/index', 'src' => 'ref1', '#' => 'name']);// /index.php?r=post/edit&id=100 assume the alias "@postEdit" is defined as "post/edit"echo Url::toRoute(['@postEdit', 'id' => 100]);// http://www.example.com/index.php?r=site/indexecho Url::toRoute('site/index', true);// https://www.example.com/index.php?r=site/indexecho Url::toRoute('site/index', 'https');
Url::to
// /index.php?r=site/indexecho Url::to(['site/index']);// /index.php?r=site/index&src=ref1#nameecho Url::to(['site/index', 'src' => 'ref1', '#' => 'name']);// /index.php?r=post/edit&id=100 assume the alias "@postEdit" is defined as "post/edit"echo Url::to(['@postEdit', 'id' => 100]);// the currently requested URLecho Url::to();// /images/logo.gifecho Url::to('@web/images/logo.gif');// images/logo.gifecho Url::to('images/logo.gif');// http://www.example.com/images/logo.gifecho Url::to('@web/images/logo.gif', true);// https://www.example.com/images/logo.gifecho Url::to('@web/images/logo.gif', 'https');
阅读全文
0 0
- Yii2 关于 Url::toRoute 和Url::to 路径 例子
- URL::to() 与 URL::toRoute()
- URL::to() 与 URL::toRoute()
- 总结Yii2.0中的Url::to(), Url::toRoute(), Url::current()用法
- 总结Yii2.0中的Url::to(), Url::toRoute(), Url::current()用法
- 总结Yii2.0中的Url::to(), Url::toRoute(), Url::current()用法
- Yii2.0 to(), toRoute(), current()区别用法
- 关于绝对路径、相对路径和URL
- 关于url-pattern的写法和路径
- yii2如何优化URL的路径
- url 关于路径
- yii2的URL解析和生成
- yii2 url 重写 自定义url
- 关于url-pattern的编写方式和路径总结
- 关于URI和URL
- 关于URI和URL
- 关于URL和URI
- Yii2 URL生成
- Sublime Text编辑器在前端中的快捷操作
- 5种排序算法的Java代码
- 杭电oj1017
- AutoCAD文档01——安装教程
- No module named keras
- Yii2 关于 Url::toRoute 和Url::to 路径 例子
- 多线程笔试面试题(1)
- two weeks vim(2)
- HDU 3522 Farming(转化为体积并来写)
- Mac安装Mongodb
- 5种排序算法的c#代码(1)
- React-Native进阶_1.抽取样式和组件
- nm: test.o: File format not recognized的原因和解决方案
- 配置JAVA的环境变量