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

ÔÚThinkPHPÖÐÔõôʵÏÖURLÖÐÎÄתÂë

ÔÚURLÖÐʹÓÃÖÐÎÄ×Ö·ûÊǺܳ£¼ûµÄÐèÇó£¬ÀýÈçÔÚÂÛ̳ÖУ¬Ìû×ÓµÄÎÊÌâ¾­³£ÊÇÖÐÎĵÄ£¬ÐèÒª½«Æä×÷ΪURLµÄÒ»²¿·ÖÀ´ÌìÉúÒ³ÃæµØµã¡£¿ÉÊÇ£¬ÓÉÓÚÀúÊ·Ôµ¹ÊÔ­ÓɺÍЭÒéÏÞÖÆ£¬URLÖ»ÄÜʹÓÃASCIIÂë±íÖб£´æµÄ×Ö·û¡£ÎªÁËÄܹ»Ê¹ÓÃÖÐÎÄ×Ö·ûÌìÉúURLµØµã£¬ÎÒÃÇÐèÒªÒ»ÖÖÒªÁ콫ÕâЩ×Ö·ûת»»³ÉÇå¾²µÄURL×Ö·û¡£

Ò»ÖÖ³£¼ûµÄתÂëÒªÁìÊÇʹÓÃurlencodeº¯Êý¡£´Ëº¯ÊýµÄ×÷ÓÃÊǽ«ÖÐÎÄ×Ö·ûת»»ÎªÌØÊâµÄÊ®Áù½øÖƱàÂ룬ÒÔ×èÖ¹ÔÚURLÖÐÔì³É³åÍ»¡£ÔÚThinkPHPÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃurlº¯Êý¾ÙÐÐURL±àÂë¡£ÀýÈ磺

$url = url('/index/index', ['title' => urlencode('ÖÐÎÄÄÚÈÝ')]);

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÀý×ÓÖУ¬ÎÒÃǽ«ÖÐÎÄÄÚÈÝת»»Îªurlencode±àÂ룬²¢½«Æä×÷Ϊtitle²ÎÊýת´ï¸øÁËÎÒÃǵĿØÖÆÆ÷ÒªÁì¡£ÔÚ¿ØÖÆÆ÷µÄÒªÁìÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃurldecodeº¯ÊýÀ´»¹Ô­±»×ªÂëµÄÖÐÎÄ×Ö·û¡£ÀýÈ磺

public function index($title)
{
    $title = urldecode($title);
    // ...
}

µÇ¼ºó¸´ÖÆ

ÕâÖÖÒªÁìÊÇ¿ÉÐеÄ£¬µ«ËüÓÐÒ»¸öÏÔÖøµÄÈõµã£¬¾ÍÊÇÊ®Áù½øÖƱàÂëºóµÄ×Ö·û¹´Í¨³£±ÈԭʼµÄÖÐÎÄ×Ö·û´®Òª³¤Ðí¶à£¬Õâ»áµ¼ÖÂURL±äµÃºÜÊÇòÇÞºÍÄÑÒÔÓ°Ïó¡£

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

ÖÐÎÄ×Ö·ûµÄURL±àÂë¿ÉÒÔͨ¹ýʹÓÃURLÇå¾²µÄBase64±àÂëÀ´ÊµÏÖ£¬´Ó¶ø½â¾ö¸ÃÎÊÌâ¡£ÔÚThinkPHPÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃbase64url_encodeºÍbase64url_decodeº¯Êý¡£ÀýÈ磺

$url = url('/index/index', ['title' => base64url_encode('ÖÐÎÄÄÚÈÝ')]);

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÀý×ÓÖУ¬ÎÒÃǽ«ÖÐÎÄÄÚÈÝʹÓÃURLÇå¾²µÄBase64±àÂ룬²¢½«Æä×÷Ϊtitle²ÎÊýת´ï¸øÁËÎÒÃǵĿØÖÆÆ÷ÒªÁì¡£ÎÒÃÇ¿ÉÒÔÔÚ¿ØÖÆÆ÷ÒªÁìÖÐʹÓÃbase64url_decodeº¯Êý½«Æä½âÂë³ÉԭʼµÄÖÐÎÄ×Ö·û¡£ÀýÈ磺

public function index($title)
{
    $title = base64url_decode($title);
    // ...
}

µÇ¼ºó¸´ÖÆ

ʹÓÃBase64±àÂëµÄÒªÁìÏà±ÈÓÚurlencodeÒªÁìÓÐÒ»¸öÏÔ×ŵÄÓŵ㣬ÄǾÍÊÇËüÌìÉúµÄ±àÂë×Ö·û´®Ïà¶Ô½Ï¶Ì£¬Ô½·¢ÑŹۡ¢Ò׶Á¡£µ«ÐèҪעÖصÄÊÇ£¬ÕâÖÖÒªÁìÔÚÌìÉúURLÇå¾²×Ö·û´®Ê±£¬ÐèҪʹÓÃһЩÌØÊâµÄ×Ö·ûÌ滻ԭʼµÄBase64×Ö·û£¬ÀýÈ罫·ûºÅ+Ì滻Ϊ-£¬½«·ûºÅ/Ì滻Ϊ_£¬²¢È¥µô×îºó¿ÉÄÜ·ºÆðµÄ=·ûºÅ¡£

ÔÚÏÖʵ¿ª·¢ÖУ¬ÎÒÃÇ¿ÉÒÔƾ֤×Ô¼ºµÄÐèÇóÑ¡ÔñºÏÊʵÄתÂëÒªÁì¡£ÎÞÂÛÊÇurlencodeÕÕ¾ÉBase64±àÂ룬ÎÒÃǶ¼ÐèҪעÖØÌìÉúµÄURLÊÇ·ñÇкϹ淶£¬²¢ÇÒÔÚ¿ØÖÆÆ÷ÒªÁìÖоÙÐÐ׼ȷµÄ½âÂë´¦Àí£¬ÒÔ°ü¹ÜÎÒÃǵÄÓ¦ÓÃÄܹ»Õý³£´¦ÀíÖÐÎÄ×Ö·ûµÄURL¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ