尊龙凯时人生就是搏

thinkphpÔõôʵÏÖÌøתҳÃæ

Ò»¡¢Ê¹ÓÃredirectº¯ÊýÌøתҳÃæ

ÔÚthinkphpÖУ¬Ìøתµ½ÆäËûÒ³Ãæ¿ÉÒÔʹÓÃredirectº¯Êý¡£¸Ãº¯ÊýµÄÓ÷¨ÈçÏ£º

public function redirect($url, $params = [], $code = 302, $withPrefix = false)

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬$urlÌåÏÖÒªÌøתµÄÒ³Ãæ·¾¶£¬$paramsÌåÏÖÌøתʱÐèҪת´ïµÄ²ÎÊý£¬$codeÌåÏÖÌøתµÄHTTP״̬Â룬$withPrefixÌåÏÖÊÇ·ñ´øÉÏÓòÃûǰ׺¡£ÏÂÃæÊÇһЩʹÓøú¯ÊýµÄʾÀý£º

1.Ìøתµ½ÆäËû¿ØÖÆÆ÷µÄÒªÁì

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

// Ìøתµ½Home¿ØÖÆÆ÷µÄindexÒªÁì
return $this->redirect('home/index');

µÇ¼ºó¸´ÖÆ

2.Ìøתµ½ÍⲿURL

return $this->redirect('http://www.example.com');

µÇ¼ºó¸´ÖÆ

3.´ø²ÎÊýÌøת

// Ìøתµ½Home¿ØÖÆÆ÷µÄdetailÒªÁ죬²¢×ª´ïid²ÎÊý
return $this->redirect('home/detail', ['id' => 1]);

µÇ¼ºó¸´ÖÆ

¶þ¡¢Ê¹ÓÃurlº¯ÊýÌìÉúÌøת·¾¶

³ýÁËʹÓÃredirectº¯ÊýÌøתҳÃæÍ⣬»¹¿ÉÒÔʹÓÃurlº¯ÊýÌìÉúÌøת·¾¶£¬È»ºóʹÓÃredirectº¯Êý¾ÙÐÐÌøת¡£urlº¯ÊýµÄÓ÷¨ÈçÏ£º

public function url($url = '', $vars = '', $suffix = true, $domain = false)

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬$urlÌåÏÖÒªÌìÉúµÄURLµØµã£¬$varsÌåÏÖҪת´ïµÄ²ÎÊý£¬$suffixÌåÏÖÊÇ·ñÆôÓÃURLºó׺£¬$domainÌåÏÖÊÇ·ñ´øÉÏÓòÃûǰ׺¡£

ÏÂÃæÊÇÒ»¸öʹÓÃurlº¯ÊýÌìÉúÌøת·¾¶µÄʾÀý£º

// ÌìÉúHome¿ØÖÆÆ÷µÄindexÒªÁìµÄURL
$url = $this->url('home/index');
return $this->redirect($url);

µÇ¼ºó¸´ÖÆ

ÒÔÉϾÍÊÇthinkphpÔõôʵÏÖÌøתҳÃæµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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