Home  >  Article  >  Backend Development  >  看一上传参数这个有关问题,小弟我不太明白

看一上传参数这个有关问题,小弟我不太明白

WBOY
WBOYOriginal
2016-06-13 13:14:08706browse

看一下传参数这个问题,我不太明白
$action = $_REQUEST['act'] ? $_REQUEST['act'] : 'list';为什么要这样写,什么意思,不明白 
if ($action == 'list')
{
/* 分页 */
$tpp = 15;
  $page = max(1, intval($_REQUEST['page']));
  $start_limit = ($page - 1) * $tpp;
$url = "?act=list";
$cat_id = isset($_REQUEST['cat_id']) ? intval($_REQUEST['cat_id']) : 0;这块为什么又这样写呢,后面还多个0

switch ($sortkey)
{
case 'id':
$order = " ORDER BY id DESC ";
$url .= "&orderby=$orderby";这块为什么用.=呢
break;
case 'visit':
$order = " ORDER BY views DESC ";
$url .= "&ord





------解决方案--------------------
$url .= "&orderby=$orderby";这块为什么用.=呢
拼装url连接。

我来补充个例子

$url = '123456';
$url .= '789';

echo $url;
//输出:123456789

Statement:
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