锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产情侣久久久久aⅴ免费,97久久精品人妻人人搡人人玩,国内精品伊人久久久久AV影院http://m.shnenglu.com/egametang/zh-cnSat, 28 Jun 2025 10:53:38 GMTSat, 28 Jun 2025 10:53:38 GMT60C++ protobuf 涓嶄粎浠呮槸搴忓垪鍖栤︹?/title><link>http://m.shnenglu.com/egametang/archive/2012/04/12/171063.html</link><dc:creator>鍞愯瘲</dc:creator><author>鍞愯瘲</author><pubDate>Thu, 12 Apr 2012 04:09:00 GMT</pubDate><guid>http://m.shnenglu.com/egametang/archive/2012/04/12/171063.html</guid><wfw:comment>http://m.shnenglu.com/egametang/comments/171063.html</wfw:comment><comments>http://m.shnenglu.com/egametang/archive/2012/04/12/171063.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://m.shnenglu.com/egametang/comments/commentRss/171063.html</wfw:commentRss><trackback:ping>http://m.shnenglu.com/egametang/services/trackbacks/171063.html</trackback:ping><description><![CDATA[<div><span style="font-size: 12px;">涓鐐瑰皬鐗㈤獨 cppblog鍜屽崥瀹㈠洯鏄暐鍏崇郴鍛紵鍚屼袱杈圭殑浜轟氦嫻佷氦嫻?闅鵑亾鎴戜袱杈歸兘瑕佸彂涓閬嶏紵<br /><br />      C++涓璸rotobuf鏄釜甯哥敤鐨勫簭鍒楀寲搴擄紝緗戠粶娑堟伅鍙戦侊紝娑堟伅瑙f瀽閮藉崄鍒嗘柟渚匡紝xml鍙互騫茬殑錛屽畠閮借兘騫層備絾鏄畠緇濅笉浠呬粎鏄簭鍒楀寲搴撱?/span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">綆鍗曠殑璇達紝protobuf緇機++澧炲姞浜咰# attribute鐨勫姛鑳姐侰++浠庢灝辨湁浜嗗厓鏁版嵁浜嗭紒浼歝#鐨勫悓瀛﹁偗瀹氭槑鐧戒簡榪欏彞璇濈殑鎰忎箟浜嗐?/span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">涓. protobuf鐢ㄤ綔閰嶇疆鏂囦歡錛?/span></div><div><span style="font-size: 12px;">protobuf鎻愪緵浜嗕竴縐峵extformat鐨勫簭鍒楀寲鏍煎紡錛岀被浼糺son鏍煎紡錛屾竻鏅版槗璇匯傛瘮濡備竴媯佃涓烘爲鑺傜偣鎻忚堪鏂囦歡錛?/span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">鏁版嵁瀹氫箟涓猴細</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message BehaviorNodeConf</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 type = 1;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 鏉′歡闇瑕佺殑鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>repeated int32 args = 2;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 鍖呭惈澶氫釜瀛愯妭鐐?/span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>repeated BehaviorNodeConf node = 3;</span></div><div><span style="font-size: 12px;">};</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message BehaviorTreeConf</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 琛屼負鏍戠被鍨? AI, ON_HIT, ON_HITTED ...</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 type = 1;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 琛屼負鏍戣妭鐐?/span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required BehaviorNodeConf node = 2;</span></div><div><span style="font-size: 12px;">};閰嶇疆鏂囦歡涓猴細</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">type: 5</span></div><div><span style="font-size: 12px;">node:</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 1</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>node:</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 101</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: 2</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>node:</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 1</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>node:</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 1001</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: 0</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: 100</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>node:</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>type: 1001</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: 1</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>args: -100</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;">} 浠ヤ笅涓よ浠g爜鍗沖彲瑙f瀽榪欎釜閰嶇疆鏂囦歡錛欱ehaviorTreeConf conf;</span></div><div><span style="font-size: 12px;">google::protobuf::TextFormat::ParseFromString(fileContent, &conf);浜? protobuf鐨勫弽灝勭敤娉?/span></div><div><span style="font-size: 12px;">寰堝浜洪兘璇碈++寰堥毦鍋歄rm錛屽洜涓烘病鏈夊弽灝勭瓑絳夛紝鏈変簡protobuf榪欎竴鍒囬兘涓嶆槸闂浜嗭紝濡備笅錛?/span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">select鎿嶄綔錛氳嚜鍔ㄧ敓鎴恠elect璇彞錛屾煡璇竴鏉¤褰曟妸瀹冧繚瀛樺埌person鍙橀噺閲岄潰</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>try</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>DbHelper dbHelper("tcp://127.0.0.1:3306", "root", "111111");</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>DbResultPtr result = dbHelper.Execute(</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Select<Person>(Column("*")).</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Where(Column("age") > 10)</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>);</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>auto person = boost::make_shared<Person>();</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>result->One(person);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>ASSERT_EQ(26, person->age());</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>catch (const Exception& e)</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>}  update鎿嶄綔: 鑷姩鐢熸垚update璇彞錛岃繖孌典唬鐮佹槸浠庢垜鐨勫崟鍏冩祴璇曢噷闈㈡姞鍑烘潵鐨勶紝澶у鏄庣櫧鎰忔濆氨琛屼簡TEST_F(UpdateTest, Update_Where)</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>std::string expectedSql;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>expectedSql =</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>"update Egametang.Person "</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>"set guid = 1, age = 18, comment = 'a good student!' "</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>"where age > 10";</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Person person;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>person.set_guid(1);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>person.set_age(18);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>person.set_comment("a good student!");</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>Update update(person);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>update.Where(Column("age") > 10);</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>EXPECT_EQ(expectedSql, update.ToString());</span></div><div><span style="font-size: 12px;">} 涓?protbuf 綾諱技c# attribute鍔熻兘</span></div><div><span style="font-size: 12px;">鐪嬪涓嬩竴孌祊rotobuf瀹氫箟錛歩mport "google/protobuf/descriptor.proto";</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">extend google.protobuf.FileOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional string my_file_option = 50000;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.MessageOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional int32 my_message_option = 50001;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.FieldOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional float my_field_option = 50002;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.EnumOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional bool my_enum_option = 50003;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.EnumValueOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional uint32 my_enum_value_option = 50004;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.ServiceOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional MyEnum my_service_option = 50005;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;">extend google.protobuf.MethodOptions </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    optional MyMessage my_method_option = 50006;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">option (my_file_option) = "Hello world!";</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message MyMessage </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    option (my_message_option) = 1234;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">    optional int32 foo = 1 [(my_field_option) = 4.5];</span></div><div><span style="font-size: 12px;">    optional string bar = 2;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">enum MyEnum </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    option (my_enum_option) = true;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">    FOO = 1 [(my_enum_value_option) = 321];</span></div><div><span style="font-size: 12px;">    BAR = 2;</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message RequestType {}</span></div><div><span style="font-size: 12px;">message ResponseType {}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">service MyService </span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;">    option (my_service_option) = FOO;</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">    rpc MyMethod(RequestType) returns(ResponseType) </span></div><div><span style="font-size: 12px;">    {</span></div><div><span style="font-size: 12px;">        // Note:  my_method_option has type MyMessage.  We can set each field</span></div><div><span style="font-size: 12px;">        //   within it using a separate "option" line.</span></div><div><span style="font-size: 12px;">        option (my_method_option).foo = 567;</span></div><div><span style="font-size: 12px;">        option (my_method_option).bar = "Some string";</span></div><div><span style="font-size: 12px;">    }</span></div><div><span style="font-size: 12px;">}protobuf涓殑option灝辨槸C#涓殑attribute錛宱ption鍚屾牱鍙互鏀懼湪message錛堝悓c#鐨刢lass錛?service錛堝悓c#鐨勬柟娉曪級 浠ュ強message鐨刦ield涓婇潰</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">鍥?娓告垙寮鍙戜腑濡備綍鍒╃敤protobuf鐨勮繖鍔熻兘鍛紵</span></div><div><span style="font-size: 12px;">1.絳栧垝浣跨敤protobuf浣滀負閰嶇疆鏂囦歡錛屾垜鍙互鍦ㄦ暟鎹畾涔変腑璁劇疆鏌愪釜瀛楁鐨刼ption涓篊#鐨勫摢涓帶浠訛紝</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">緙栬緫鍣ㄨ鍒拌繖涓暟鎹畾涔夊氨鍙互鐩存帴鐢熸垚涓涓帶浠訛紝鍥犳鍙互鏍規(guī)嵁鏁版嵁瀹氫箟鐢熸垚緙栬緫鍣ㄧ粰絳栧垝濉啓鏁版嵁銆備緥濡傦細</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message BehaviorNodeConf</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 type = 1 [control = "textbox" max = 100 min = 0];</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>// 鏉′歡闇瑕佺殑鍙傛暟</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>repeated int32 args = 2 [control = "textbox"];</span></div><div><span style="font-size: 12px;">}; 2.鍐嶅錛?鎶鑳藉彲浠ユ柦鏀綽uff錛屾瘡涓猙uff閮藉簲璇ユ湁涓涓叧鑱旂殑鎶鑳斤紝閭d箞絳栧垝濉〃鐨勬椂鍊欒濉竴涓妧鑳界殑proto琛ㄨ繕瑕佸~涓涓猙uff鐨刾roto琛紝涓ゅ紶琛ㄧ瓥鍒掑緢瀹規(guī)槗灝卞~婕忎簡鎴戜滑鍙互鍔犱笂涓涓害鏉燂紝鐢辯紪杈戝櫒鍘繪鏌ワ細message Spell</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 id = 1;</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>optional int32 buffId = 2 [ref = "Buff.id"];</span></div><div><span style="font-size: 12px;">}</span></div><div><span style="font-size: 12px;"><br /></span></div><div><span style="font-size: 12px;">message Buff</span></div><div><span style="font-size: 12px;">{</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>required int32 id = 1 [ref = "Spell.buffId"];</span></div><div><span style="font-size: 12px;"><span style="white-space:pre"> </span>optional int32 time = 2;</span></div><div><span style="font-size: 12px;">}緙栬緫鍣ㄥ~鍐欎竴涓猙uff浼氬幓媯鏌ユ槸鍚︽湁鍏寵仈榪欎釜buff鐨勬妧鑳藉瓨鍦紝濉妧鑳界殑鏃跺欏鏋滃~浜哹uff涔熻寮哄埗閰嶇疆鐩稿簲鐨刡uff錛岃繖鏍峰ぇ澶у噺灝戜簡閰嶇疆閿欒錛岀瓥鍒掍粠姝や粠濉〃閿欒涓В鑴卞嚭鏉ャ? 絳栧垝鐖戒簡錛岀▼搴忓憳鐨勭埥榪樿繙鍚楋紵 浠栧ソ鎴戜篃濂斤紒 protobuf鍐欑殑涓涓畝鏄搊rm,鐩墠瀹炵幇浜唖elect鍜寀pdate錛屽叾瀹冪殑鍚庣畫澧炲姞錛屽師鐞嗘槸涓鏍風殑浠g爜鍦板潃錛?https://github.com/egametang/Egametang/tree/master/Cpp/Platform/Orm</span></div><img src ="http://m.shnenglu.com/egametang/aggbug/171063.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.shnenglu.com/egametang/" target="_blank">鍞愯瘲</a> 2012-04-12 12:09 <a href="http://m.shnenglu.com/egametang/archive/2012/04/12/171063.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://m.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.hfhyzt.cn" target="_blank">精品国产一区二区三区久久久狼 </a>| <a href="http://www.gmyk.net.cn" target="_blank">国产精品免费久久久久影院</a>| <a href="http://www.ghzu.cn" target="_blank">亚洲狠狠综合久久</a>| <a href="http://www.bdfu-edu.cn" target="_blank">久久国产精品视频</a>| <a href="http://www.sms321.cn" target="_blank">99re这里只有精品热久久</a>| <a href="http://www.gofiv.cn" target="_blank">久久综合久久伊人</a>| <a href="http://www.trademan.cn" target="_blank">99久久无码一区人妻</a>| <a href="http://www.888google.cn" target="_blank">久久综合视频网</a>| <a href="http://www.zzxsyh.cn" target="_blank">99久久精品国产一区二区三区</a>| <a href="http://www.xsvt.cn" target="_blank">日韩久久久久中文字幕人妻</a>| <a href="http://www.u4439.cn" target="_blank">国产亚洲精午夜久久久久久 </a>| <a href="http://www.bhga.cn" target="_blank">久久香蕉国产线看观看99</a>| <a href="http://www.qwqsd.cn" target="_blank">成人久久综合网</a>| <a href="http://www.51yueda.cn" target="_blank">国产精品成人久久久</a>| <a href="http://www.sg1024.cn" target="_blank">久久久久亚洲AV成人网</a>| <a href="http://www.dnsdna.cn" target="_blank">色综合久久中文字幕无码</a>| <a href="http://www.www9785.cn" target="_blank">亚洲一级Av无码毛片久久精品</a>| <a href="http://www.vgqk.cn" target="_blank">久久国产综合精品五月天</a>| <a href="http://www.touzhi8.cn" target="_blank">精品久久8x国产免费观看</a>| <a href="http://www.youk6.cn" target="_blank">亚洲国产精品无码久久久秋霞2</a>| <a href="http://www.00175.com.cn" target="_blank">亚洲国产精品热久久</a>| <a href="http://www.caster.org.cn" target="_blank">久久人人爽爽爽人久久久</a>| <a href="http://www.0510beta.cn" target="_blank">久久久精品2019免费观看</a>| <a href="http://www.bjscqh.com.cn" target="_blank">亚洲国产另类久久久精品</a>| <a href="http://www.iceplaza.cn" target="_blank">看全色黄大色大片免费久久久</a>| <a href="http://www.pyqf.net.cn" target="_blank">久久国产精品一区二区</a>| <a href="http://www.xiwangchuang.cn" target="_blank">精品国产福利久久久</a>| <a href="http://www.zhihuzhuanlan.com.cn" target="_blank">精品国产99久久久久久麻豆</a>| <a href="http://www.zjyffm.cn" target="_blank">亚洲中文字幕无码久久2017</a>| <a href="http://www.yunxinggroup.com.cn" target="_blank">久久精品国产色蜜蜜麻豆</a>| <a href="http://www.piaozen.cn" target="_blank">香蕉aa三级久久毛片</a>| <a href="http://www.nsimple.cn" target="_blank">久久久久人妻一区精品</a>| <a href="http://www.smmz.com.cn" target="_blank">精品久久久久久无码中文野结衣</a>| <a href="http://www.theredqp.cn" target="_blank">亚洲一区中文字幕久久</a>| <a href="http://www.ycsxw.cn" target="_blank">99久久精品国产一区二区三区 </a>| <a href="http://www.hanxuefs.com.cn" target="_blank">欧美牲交A欧牲交aⅴ久久</a>| <a href="http://www.ojlf.cn" target="_blank">人人妻久久人人澡人人爽人人精品</a>| <a href="http://www.xsoczv19.cn" target="_blank">久久婷婷人人澡人人</a>| <a href="http://www.3158unp.cn" target="_blank">欧美成人免费观看久久</a>| <a href="http://www.baojingqi88.org.cn" target="_blank">一97日本道伊人久久综合影院 </a>| <a href="http://www.m2fz.cn" target="_blank">精品久久久久久中文字幕人妻最新</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>