Home > php教程 > php手册 > PHP uxf framework 在模版中加入url标签

PHP uxf framework 在模版中加入url标签

WBOY
Release: 2016-06-06 19:36:05
Original
1086 people have browsed it

1. 确保不修改discuz代码; https://gitcafe.com/web3d/uxf/blob/master/upload/source/class/mvc/mvc_template.php p msg:{$msg} / p p Welcome,Phper. / p a href ="{url:'/senery-ticket/list'}" 门票 / a a href ="{url:'/senery-ticket/order/id/' . $t

1. 确保不修改discuz代码;

 

https://gitcafe.com/web3d/uxf/blob/master/upload/source/class/mvc/mvc_template.php

 

<span><span>p</span><span>></span>msg:{$msg}<span></span><span>p</span><span>></span>

<span><span>p</span><span>></span>Welcome,Phper.<span></span><span>p</span><span>></span>

<span><span>a </span><span>href</span><span>="{url:'/senery-ticket/list'}"</span><span>></span>门票<span></span><span>a</span><span>></span>
<span><span>a </span><span>href</span><span>="{url:'/senery-ticket/order/id/' . $ticket_id}"</span><span>></span>订购门票<span></span><span>a</span><span>></span></span></span></span></span>
Copy after login

 

 

3. 不覆盖discuz的结果,就是这些扩展的东西只能在uxf体系里使用

 

统一路由构造与解析 说明

比如模版中统一的url写法

{url:'/api-main/list/type/linux/order/1/name/'.$val.name}
Copy after login

 

参数说明:

  • api:模块,默认模块common可不用添加,如 /news/list/id/10
  • main:控制器
  • list:动作
  • 其他:都是参数

在普通url模式下,上述写法将会生成

idx.php?module=api<span>&mod</span>=main<span>&action</span>=list<span>&type</span>=linux<span>&order</span>=1<span>&name</span>=Ubuntu
Copy after login

 

这样的完整的url。

在pathinfo的模式下,将会生成

/api-main/list/type/linux/order/1/name/Ubuntu
Copy after login

 

在Diy的模式下,将根据自己定义的方式生成,如

/api/linux/Ubuntu
Copy after login

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template