×ðÁú¿­Ê±¹ÙÍøµÇ¼

thinkphp×Ô½ç˵Ìøת

ÔÚweb¿ª·¢ÖУ¬¾­³£ÐèÒªÔÚ³ÌÐòÖоÙÐÐÌøת£¬ÔÚthinkphpÖУ¬¿ÉÒÔʹÓÃϵͳ×Ô´øµÄÌøתº¯Êý¾ÙÐÐÌøת£¬ÀýÈçʹÓÃredirectº¯ÊýʵÏÖÖض¨Ïò¡£¿ÉÊÇÔڴ󲿷ÖÇéÐÎÏ£¬ÏµÍ³×Ô´øµÄÌøתº¯ÊýÎÞ·¨Öª×ãÎÒÃǵÄÐèÇó£¬Õâʱ¼äÎÒÃǾÍÐèÒª×Ô½ç˵Ìøתº¯Êý¡£

ÔÚthinkphpÖУ¬×Ô½ç˵Ìøתº¯Êý¿ÉÒÔͨ¹ýÔÚ¿ØÖÆÆ÷ÖбàдҪÁìʵÏÖ¡£ÏÂÃæÎÒÃÇÒÔÒ»¸ö¼òÆÓµÄʾÀýÀ´Õ¹Ê¾ÔõÑù×Ô½ç˵Ìøתº¯Êý¡£

¼ÙÉèÎÒÃÇÐèҪʵÏÖÒ»¸öÌøתº¯Êý£¬¸Ãº¯Êý¿ÉÒÔÌøתµ½Ö¸¶¨µÄURL£¬Í¬Ê±¿ÉÒÔÔÚÌøתµÄʱ¼äת´ï²ÎÊý¡£Ê×ÏÈÎÒÃÇÐèÒªÔÚ¿ØÖÆÆ÷Öнç˵һ¸öÒªÁ죬¸ÃÒªÁìµÄ²ÎÊý°üÀ¨ÒªÌøתµÄURLºÍҪת´ïµÄ²ÎÊý¡£

public function myRedirect($url, $params = [])
{
    $params_str = '';
    if(!empty($params)) {
        $params_str = http_build_query($params);
        $params_str = '&' . $params_str;
    }

    header('Location: ' . $url . $params_str);
    exit;
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄ´úÂëÖУ¬ÎÒÃÇÊ×ÏȽ«×ª´ïµÄ²ÎÊý×é×°³ÉÒ»¸öÅÌÎÊ×Ö·û´®£¬È»ºó½«Õû¸öURLºÍ²ÎÊý×Ö·û´®Æ´½Ó£¬×îºóʹÓÃheaderº¯Êý¾ÙÐÐÌøת¡£ÈôÊÇÌøתÀֳɺó£¬ÎÒÃÇ»¹ÐèҪŲÓÃexitº¯ÊýÀ´ÖÕÖ¹³ÌÐòµÄÖ´ÐС£

ʹÓÃ×Ô½ç˵Ìøתº¯Êýʱ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÔÚ¿ØÖÆÆ÷µÄÒªÁìÖÐŲÓÃmyRedirectº¯ÊýÀ´ÊµÏÖÌøת¡£ÀýÈ磺

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

public function index()
{
    $params = [
        'name' => 'thinkphp',
        'version' => '5.1'
    ];

    $url = 'https://www.thinkphp.cn';
    $this->myRedirect($url, $params);
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄʾÀýÖУ¬ÎÒÃÇÔÚindexÒªÁìÖÐŲÓÃmyRedirectº¯Êý¾ÙÐÐÌøת£¬Í¬Ê±×ª´ïÁËÒ»¸öÃûΪ$paramsµÄ²ÎÊýÊý×é¡£

×ܽ᣺

ͨ¹ý×Ô½ç˵Ìøתº¯Êý£¬ÎÒÃÇ¿ÉÒÔʵÏÖ¸üÎÞа¡¢¸ü¾«×¼µÄÌøת¡£µ±ÏµÍ³×Ô´øµÄÌøתº¯ÊýÎÞ·¨Öª×ãÎÒÃǵÄÐèÇóʱ£¬ÎÒÃÇ¿ÉÒÔƾ֤ÉÏÃæµÄÒªÁì¾ÙÐÐ×Ô½ç˵Ìøתº¯ÊýµÄ±àд¡£

ÒÔÉϾÍÊÇthinkphp×Ô½ç˵ÌøתµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ