{"id":216,"date":"2023-10-10T14:26:33","date_gmt":"2023-10-10T06:26:33","guid":{"rendered":"https:\/\/www.nickyoo7.com\/?p=216"},"modified":"2023-10-10T14:26:33","modified_gmt":"2023-10-10T06:26:33","slug":"php-%e4%bd%bf%e7%94%a8-browscap-ini-%e5%87%ba%e7%8f%be-php-syntax-error-unexpected-end-expecting-in","status":"publish","type":"post","link":"https:\/\/www.nickyoo7.com\/?p=216","title":{"rendered":"PHP \u4f7f\u7528 browscap.ini \u51fa\u73fe \u201dPHP: syntax error, unexpected $end, expecting \u2018]\u2019 in"},"content":{"rendered":"<p>PHP \u4f7f\u7528 browscap.ini \u51fa\u73fe \u201dPHP: syntax error, unexpected $end, expecting \u2018]\u2019 in \u932f\u8aa4\u8a0a\u606f<br \/>\n<!--more-->\u539f\u56e0 :<br \/>\n\u5728 browscap.ini\u00a0 \u51fa\u73fe\u4e86\u67d0\u4e9b\u5b5d\u9020\u6210\u8aa4\u5224<br \/>\n\u9700\u8655\u7406\u7684\u5b57<br \/>\n(1) [ \u958b\u982d\uff0c\u542b\u6709 ; \u7684\u8cc7\u6599\u884c\uff0c\u9700\u5c07 ; \u63db\u6210 \\;<br \/>\n(2) \u67d0\u884c\u542b\u6709 Let&#8217;s Encrypt validation server*] :\u00a0 \u5c07 Let&#8217;s \u6539\u6210 Let\\&#8217;s<\/p>\n<p>\u53ef\u4f7f\u7528\u4e0b\u5217\u4ee3\u78bc\u8655\u7406<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">&lt;?php\r\n$browsecap = file('browscap.ini');\r\nforeach( $browsecap as &amp;$row )\r\n    if ( $row[ 0 ] == '[' )\r\n        $row = str_replace( ';', '\\\\;', $row );\r\n\r\nfile_put_contents( 'fixed_browscap.ini', $browsecap );<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">#!\/bin\/sh\r\nurl=\"http:\/\/browscap.org\/stream?q=PHP_BrowsCapINI\"\r\ncurl -L -o browscap.ini ${url}\r\nsed -I \"\" -E 's\/;\/\\\\;\/g' browscap.ini\r\nsed -I \"\" -E 's\/[\\\\;]{40}\/;;;\/g' browscap.ini\r\nsed -I \"\" -E \"s\/\\'\/\\\\\\'\/g\" browscap.ini\r\nmv browscap.ini \/usr\/local\/etc\/php\/browscap.ini<\/pre>\n<p>\u53c3\u8003\u8cc7\u6599\uff1a<br \/>\nhttps:\/\/stackoverflow.com\/questions\/7615290\/browscap-ini-throwing-an-error-when-loading-php-command-line-php-cli<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP \u4f7f\u7528 browscap.ini \u51fa\u73fe \u201dPHP: syntax error, unexpected $ &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.nickyoo7.com\/?p=216\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008PHP \u4f7f\u7528 browscap.ini \u51fa\u73fe \u201dPHP: syntax error, unexpected $end, expecting \u2018]\u2019 in\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-216","post","type-post","status-publish","format-standard","hentry","category-php","entry"],"_links":{"self":[{"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=\/wp\/v2\/posts\/216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=216"}],"version-history":[{"count":1,"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=\/wp\/v2\/posts\/216\/revisions"}],"predecessor-version":[{"id":217,"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=\/wp\/v2\/posts\/216\/revisions\/217"}],"wp:attachment":[{"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nickyoo7.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}