尊龙凯时人生就是博

ÔõôÔÚThinkPHP¿ò¼ÜÖоÙÐпØÖÆÆ÷Ìøת

Ò»¡¢Ê¹ÓÃContorller¹¤¾ßµÄredirectÒªÁìʵÏÖÌøת

ʹÓÃController¹¤¾ßµÄredirectÒªÁì¿ÉÒÔÔÚThinkPHPÖÐʵÏÖÒ³ÃæÌøת¡£ÕâÖÖÒªÁìÔÊÐíʹÓÃÁ½¸ö²ÎÊý£ºµÚÒ»¸ö²ÎÊýÓÃÓÚÈ·¶¨ÌøתµÄURLµØµã£¬µÚ¶þ¸ö²ÎÊýÔòÖ¸¶¨ÔÚÌøתʱÐèҪת´ïµÄ²ÎÊýÐÅÏ¢¡£

ÏêϸµÄʵÏÖ°ì·¨ÈçÏ£º

ÔÚ¿ØÖÆÆ÷ÒªÁìÖÐŲÓÃredirectÒªÁ죬ÀýÈ磺

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

public function index()
{
    // Ìøתµ½helloÒªÁì
    $this->redirect('hello');
}

µÇ¼ºó¸´ÖÆ

ÔÚÉèÖÃÎļþÖнç˵·ÓɹæÔò£¬ÀýÈ磺

// ·Óɽç˵
return [
    // Ìøת
    'hello' => 'index/hello',
];

µÇ¼ºó¸´ÖÆ

ÕâÀォhelloÓ³Éäµ½Index¿ØÖÆÆ÷µÄhelloÒªÁì¡£

ÔÚ¿ØÖÆÆ÷µÄhelloÒªÁìÖÐʵÏÖÌøת£¬ÀýÈ磺

public function hello()
{
    // Ìøתµ½/home/index/indexÒªÁì
    $this->redirect('/home/index/index',['id'=>1]);
}

µÇ¼ºó¸´ÖÆ

ÕâÀォÌøתµ½Home¿ØÖÆÆ÷µÄindexÒªÁ죬²¢×ª´ïid²ÎÊýΪ1¡£

¶þ¡¢Ê¹ÓÃurlº¯ÊýºÍÒ³ÃæÌøתҪÁìʵÏÖÌøת

³ýÁËʹÓÃContorller¹¤¾ßµÄredirectÒªÁìʵÏÖÌøתÍ⣬»¹¿ÉÒÔʹÓÃurlº¯ÊýºÍÒ³ÃæÌøתҪÁìʵÏÖÌøת¡£

ʹÓÃurlº¯ÊýʵÏÖÌøת£º

url('Ä£¿é/¿ØÖÆÆ÷/²Ù×÷',['²ÎÊý']);

µÇ¼ºó¸´ÖÆ

ʹÓÃÒ³ÃæÌøתҪÁìʵÏÖÌøת£º

$this->success('ÌáÐÑÐÅÏ¢', 'Ìøתurl');

µÇ¼ºó¸´ÖÆ

ÆäÖÐsuccessÒªÁì¿ÉÒÔ½ÓÊÜÈý¸ö²ÎÊý£¬»®·ÖÊÇÌáÐÑÐÅÏ¢¡¢ÌøתURLºÍÆÚ´ýʱ¼ä£¬Ä¬ÈÏÆÚ´ýʱ¼äΪ1Ãë¡£

ÏÂÃæ»®·ÖÏÈÈÝʹÓÃurlº¯ÊýºÍÒ³ÃæÌøתҪÁìʵÏÖÌøתµÄÏêϸʵÏÖ°ì·¨£º

ʹÓÃurlº¯ÊýʵÏÖÌøת£¬ÀýÈ磺

public function index()
{
    // Ìøתµ½Home¿ØÖÆÆ÷µÄindexÒªÁì
    $url = url('home/index/index',['id'=>1]);
    $this->assign('url', $url);
    return $this->fetch();
}

µÇ¼ºó¸´ÖÆ

ÕâÀォÌøתµ½Home¿ØÖÆÆ÷µÄindexÒªÁ죬²¢×ª´ïid²ÎÊýΪ1¡£

ÔÚÒ³ÃæÖÐʹÓÃa±êǩʵÏÖÌøת£º

<a href="{$url}">Ìøת</a>

µÇ¼ºó¸´ÖÆ

ʹÓÃÒ³ÃæÌøתҪÁìʵÏÖÌøת£¬ÀýÈ磺

public function index()
{
    // Ìøתµ½Home¿ØÖÆÆ÷µÄindexÒªÁì
    $url = url('home/index/index',['id'=>1]);
    $this->success('ÌøתÀÖ³É', $url);
}

µÇ¼ºó¸´ÖÆ

Ìøתµ½Home¿ØÖÆÆ÷µÄindexÒªÁ죬ͬʱת´ïid²ÎÊýֵΪ1¡£Ò»ÃëÖÓºó£¬Ò³Ã潫×Ô¶¯Ìøתµ½Ô¤¶¨µÄURL£¬²¢ÏÔʾ¡°ÌøתÀֳɡ±µÄÌáÐÑ¡£

ÒÔÉϾÍÊÇÔõôÔÚThinkPHP¿ò¼ÜÖоÙÐпØÖÆÆ÷ÌøתµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ