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

thinkphp3.2ÔõôÅäÊÖ»úÕ¾ÓòÃû

Ëæ×ÅÒƶ¯»¥ÁªÍøµÄÐËÆ𠣬ԽÀ´Ô½¶àµÄÍøÕ¾×îÏȹØ×¢ÊÖ»úÕ¾µÄ½¨Éè¡£¶ø¹ØÓÚÓÃthinkphp3.2¿ò¼Ü´î½¨µÄÍøÕ¾ £¬ÔõÑù¾ÙÐÐÊÖ»úÕ¾µÄÓòÃûÉèÖÃÄØ £¿½ÓÏÂÀ´ £¬±¾ÎĽ«Îª¸÷ÈËÏêϸÏÈÈÝthinkphp3.2ÔõÑùÅäÊÖ»úÕ¾ÓòÃû¡£

Ê×ÏÈ £¬ÎÒÃÇÐèÒªÃ÷È·Ò»¸ö¿´·¨£ºÊÖ»úÕ¾ºÍPCÕ¾ÊÇÁ½¸ö×ÔÁ¦µÄÍøÕ¾ £¬ËüÃǵÄÒ³Ãæ¡¢Á´½Ó¡¢×ÊÔ´µÈ¶¼ÊǸ÷×Ô×ÔÁ¦µÄ¡£Òò´Ë £¬¹ØÓÚthinkphp3.2¿ò¼ÜÀ´Ëµ £¬ÊÖ»úÕ¾Ò²ÐèÒª×ÔÁ¦ÉèÖÃÓòÃû¡£

»ñÈ¡ÊÖ»úÕ¾ÓòÃû

Ê×ÏÈ £¬ÎÒÃÇÐèÒª»ñÈ¡Ò»¸öÊÖ»úÕ¾µÄÓòÃû¡ £¿ÉÒÔÔÚº£ÄÚµÄһЩÓòÃû×¢²áÉ̾ÙÐйºÖà £¬Ò²¿ÉÒÔÔÚÍâÑóµÄһЩע²áÉ̾ÙÐйºÖᣲ»¹ÜÊǺ£ÄÚÕÕ¾ÉÍâÑó £¬¶¼ÐèҪѡÔñÒ»¸öÎȹ̵Ä×¢²áÉÌ £¬ÒÔÈ·±£ÓòÃûµÄ¿ÉÓÃÐÔºÍÎȹÌÐÔ¡£±ðµÄ £¬ÎÒÃÇ»¹ÐèҪƾ֤ÊÖ»úÕ¾µÄÏÖÕæÏàÐÎÑ¡Ôñ²î±ðµÄÓòÃûºó׺ £¬ÀýÈç.com¡¢.cn¡¢.netµÈ¡£

ÉèÖÃÊÖ»úÕ¾µÄ¸ùĿ¼

»ñÈ¡ÁËÊÖ»úÕ¾ÓòÃûºó £¬ÎÒÃÇÐèÒªÔÚÍøÕ¾¸ùĿ¼ÏÂн¨Ò»¸öĿ¼ £¬²¢½«ÊÖ»úÕ¾µÄÒ³Ãæ¡¢Á´½Ó¡¢×ÊÔ´µÈ°²ÅÅÔÚ¸ÃĿ¼Ï¡£ÐèҪעÖصÄÊÇ £¬ÊÖ»úÕ¾µÄĿ¼½á¹¹ºÍÍøÕ¾µÄĿ¼½á¹¹ÊÇÏ໥×ÔÁ¦µÄ £¬²»ÒªÓëÍøÕ¾µÄÎļþ»ìÏý¡£

ͨ¹ýURLÖض¨ÏòʵÏÖ»á¼ûÊÖ»úÕ¾

ÓÐÁËÊÖ»úÕ¾µÄÓòÃûºÍ¸ùĿ¼ºó £¬ÎÒÃÇÐèÒª¶ÔÍøÕ¾¾ÙÐÐÉèÖà £¬ÈÃÓû§ÔÚ»á¼ûÍøվʱÄܹ»Ö±½ÓÌøתµ½ÊÖ»úÕ¾¡£ÎÒÃÇ¿ÉÒÔͨ¹ýURLÖض¨ÏòµÄ·½·¨ÊµÏÖÕâһĿµÄ¡£

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

ÔÚthinkphp3.2¿ò¼ÜÖÐ £¬¿ÉÒÔͨ¹ýÔÚÈë¿ÚÎļþÖÐÉèÖÃÏà¹Ø´úÂëʵÏÖURLÖض¨Ïò £¬Ê¾Àý´úÂëÈçÏ£º

//ÅжÏÊÇ·ñÊÇÒƶ¯×°±¸»á¼û
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false) {
    //Ìøתµ½ÊÖ»úÕ¾
    header('Location:http://m.example.com');
    exit;
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄ´úÂëÖÐ £¬ÎÒÃÇÊ×ÏÈɨÃè»á¼ûÍøÕ¾µÄ×°±¸ÀàÐÍ £¬ÈôÊÇÊÇÒƶ¯×°±¸ £¬Ôò½«Óû§Öض¨Ïòµ½ÊÖ»úÕ¾µÄÓòÃûÏ¡£ÕâÑù £¬Óû§ÔÚ»á¼ûÍøվʱ £¬¾Í»áÖ±½ÓÌøתµ½ÊÖ»úÕ¾ £¬ÊµÏÖ¿ì½Ý»á¼û¡£

ÉèÖÃÊÖ»úÕ¾µÄÈ«Õ¾SSLÖ¤Êé

¹ØÓÚÊÖ»úÕ¾À´Ëµ £¬ÎªÁË°ü¹ÜÓû§µÄÐÅÏ¢Çå¾² £¬ÎÒÃÇÐèҪΪÊÖ»úÕ¾ÉèÖÃÈ«Õ¾SSLÖ¤Ê顣ͨ¹ýSSLÖ¤ÊéµÄ¼ÓÃÜÊÖÒÕ £¬¿ÉÒÔ°ü¹ÜÓû§ÔÚÊÖ»úÕ¾»á¼ûµÄÐÅÏ¢²»±»ºÚ¿ÍÇÔÈ¡»òЮÖÆ¡£Òò´Ë £¬ÉèÖÃÈ«Õ¾SSLÖ¤ÊéºÜÊÇÖ÷Òª¡£

ÔÚthinkphp3.2¿ò¼ÜÖÐ £¬¿ÉÒÔͨ¹ý»ñÈ¡SSLÖ¤ÊéºÍ˽ԿÎļþµÄ·½·¨À´ÊµÏÖSSLÉèÖá£Ê¾Àý´úÂëÈçÏ£º

//»ñÈ¡SSLÖ¤ÊéºÍ˽ԿÎļþ
$certfile = 'ssl/xxxx.crt';//Ö¤ÊéÎļþ·¾¶
$keyfile = 'ssl/xxxx.key'; //˽ԿÎļþ·¾¶

//ʹÓÃSSLÖ¤ÊéºÍ˽ԿÎļþ
$opts = array(
    'ssl' => array(
        'local_cert' => $certfile,
        'local_pk' => $keyfile,
    ),
);

//½á¹¹Context stream context
$context = stream_context_create($opts);

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄ´úÂëÖÐ £¬ÎÒÃÇÊ×ÏÈ»ñÈ¡SSLÖ¤ÊéºÍ˽ԿÎļþµÄ·¾¶ £¬È»ºóʹÓÃÕâÁ½¸öÎļþʵÀý»¯Ò»¸östream context¹¤¾ß £¬×îºóʹÓøù¤¾ßʵÏÖSSLÉèÖá£

×ܽá

ͨ¹ýÉÏÊö°ì·¨ £¬ÎÒÃÇ¿ÉÒÔ½«thinkphp3.2¿ò¼ÜÖеÄÍøÕ¾ºÍÊÖ»úվʵÏÖ×ÔÁ¦ÓòÃûµÄ»á¼û¡£ÕâÑù £¬Óû§ÔÚ»á¼ûÍøվʱ £¬¿ÉÒÔƾ֤²î±ðµÄ×°±¸ÀàÐÍ×Ô¶¯Ìøתµ½ÏìÓ¦µÄÕ¾µã £¬Ìá¸ßÁËÓû§µÄ»áÊÕЧÂʺÍʹÓÃÌåÑ顣ͬʱ £¬Í¨¹ýÉèÖÃÈ«Õ¾SSLÖ¤Êé £¬¿ÉÒÔ°ü¹ÜÓû§ÐÅÏ¢µÄÇå¾²ÐÔ £¬Ìá¸ßÁËÍøÕ¾µÄÇå¾²ÐÔ¡£

ÒÔÉϾÍÊÇthinkphp3.2ÔõôÅäÊÖ»úÕ¾ÓòÃûµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ