路由是各种框架中比较重要的环节。
use think\facade\Route;
Route::rule('new/:id','News/read','GET|POST');
|类型| 描述 |快捷方法|
|:----:|:----:|:----:|:----:|
|GET| GET请求| get|
|POST| POST请求| post|
|PUT| PUT请求| put|
|DELETE| DELETE请求| delete|
|PATCH| PATCH请求| patch|
|| 任何请求类型| any|
Route::view('hello/:name', 'index/hello', ['city'=>'shanghai']);
在模板中可以输出name和city两个变量。
Hello,{$name}--{$city}!
$this->request->get('id', 100) 的意思获取id的值,当没有提交id参数时用默认值替代,也就是说可以获取到100,有id参数时无论是否有值,均以请求为准。
$this->request->has('id', 'get') 是判断否有id参数,当前get请求时有id参数,无论是否有值均返回true,当没有id参数时返回false
不明白时建议多看看框架源码,这样对你更有帮助,比在网上提问更高效。
第一种 表单提交
第二种 ajax 要用你input框的id和select框的id
<script>//地址添加提交
$(function () {
$('#address_submit')click(function () {
layerload(1,{time:1000});
var select_country=$('#select_country option:selected')text();//select框
var select_province=$('#select_province option:selected')text();
var select_city=$('#select_city option:selected')text();
var consignee=$('#consignee')val();
var phone=$('#phone')val();
var address_detail=$('#address_detail')val();
if(!select_country || !select_province || !consignee || !phone || !address_detail){
layermsg('Please complete the receipt information', {icon: 2,offset: '100px',time:'1200'});
}
$post("{:U('User/addAddress')}",{
'select_country':select_country,
'select_province':select_province,
'select_city':select_city,
'consignee':consignee,
'phone':phone,
'address_detail':address_detail,
},function (data) {
if(data=='success'){
layermsg('operation success', {icon: 1,offset: '100px',time:'1000'});
setTimeout("windowlocationreload()",1000);
}
else{
if (data == 'no_session') {
layermsg('Login information has failed please log in again ', {icon: 2, offset: '100px', time: '1000'});
setTimeout("locationhref = '{:U("index/Login/login")}'", 1000);
return false;
}
layermsg(JSONstringify(data), {icon: 2,offset: '100px',time:'1500'});
return false;
}
},'json');
});
})
</script>
TP是魔兽争霸对战的一种专用术语。
TP在魔兽争霸对战中为“回城卷轴”,在对战中与盟友发送此信息,即表示令其回城或告之自己准备回城。它的英文翻译是“townportal”直译的中文意思是城门,在游戏为了简单明了就采用了缩写,回城卷轴的英文全名为“scrolloftownportal”。
当然TP还有很多意思。那就要看在不同场景下的不同运用了。作为视频时讲,有两层含义:第一层含义即TransportProgram的简称,意为程序流,是一类程序流编码方式的视频的总称。二层含义即当前的一种HDTV转录的高清视频格式。tp还有禁言处罚的意思。tp=停止post权限/terminatepost,对于违反论坛规定的用户进行禁言处罚。
以上就是关于tp6-路由全部的内容,包括:tp6-路由、在tp5框架中$this->request->get('id', 100);是什么功能、think php 后台如何获取 文本框里面的值等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)