yii2 url生成以及图片等的引入
2015-09-07 16:30
537 查看
// /index?r=site/index
echo Url::to(['site/index']);
// /index?r=site/index&src=ref1#name
echo Url::to(['site/index', 'src' => 'ref1', '#' => 'name']);
// the currently requested URL
echo Url::to();
// /images/logo.gif
echo Url::to('@web/images/logo.gif');
// images/logo.gif
echo Url::to('images/logo.gif');
// http://www.example.com/images/logo.gif
echo Url::to('@web/images/logo.gif', true);
// https://www.example.com/images/logo.gif
echo Url::to('@web/images/logo.gif', 'https');
// /index?r=site/index
echo Url::toRoute('site/index');
// /index?r=site/index&src=ref1#name
echo Url::toRoute(['site/index', 'src' => 'ref1', '#' => 'name']);
// http://www.example.com/index.php?r=site/index
echo Url::toRoute('site/index', true);
// https://www.example.com/index.php?r=site/index
echo Url::toRoute('site/index', 'https');
echo Yii::$app->urlManager->createUrl('site/index')
转::http://lmh860628.blog.163.com/blog/static/193976102201551210025248/
echo Url::to(['site/index']);
// /index?r=site/index&src=ref1#name
echo Url::to(['site/index', 'src' => 'ref1', '#' => 'name']);
// the currently requested URL
echo Url::to();
// /images/logo.gif
echo Url::to('@web/images/logo.gif');
// images/logo.gif
echo Url::to('images/logo.gif');
// http://www.example.com/images/logo.gif
echo Url::to('@web/images/logo.gif', true);
// https://www.example.com/images/logo.gif
echo Url::to('@web/images/logo.gif', 'https');
// /index?r=site/index
echo Url::toRoute('site/index');
// /index?r=site/index&src=ref1#name
echo Url::toRoute(['site/index', 'src' => 'ref1', '#' => 'name']);
// http://www.example.com/index.php?r=site/index
echo Url::toRoute('site/index', true);
// https://www.example.com/index.php?r=site/index
echo Url::toRoute('site/index', 'https');
echo Yii::$app->urlManager->createUrl('site/index')
转::http://lmh860628.blog.163.com/blog/static/193976102201551210025248/
相关文章推荐
- ThinkPHP通过AJAX返回JSON的两种实现方法
- PHP 数字转汉字函数
- php 递归的生成目录函数
- php图片水印添加,压缩,剪切的封装类实现
- Yii2 DetailView添加html属性
- 关于thinkphp中U函数传参数问题
- 模板输出U方法带锚点 thinkphp
- php unserialize(): Error at offset 470 of 660 bytes
- PHP找回密码机制流程
- PHP学习---ThinkCMF的三个基类
- php验证码实现代码(3种)
- phpstrom 如何设置php开发环境----已经安装了xampp开发环境
- PHP json数据格式化方法
- Yii2高级模板的安装
- PHP学习---THINKCMF目录结构学习
- 送给和我一样曾经浮躁过的PHP程序猿
- PHP学习----Access denied for user 'root'@'localhost'
- PHPExcel类实用的方法总结
- 怎么在THINKPHP中引入PHP文件
- SDP协议分析