国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

? ??? ?? PHP ???? ??? ??? ????? ???? PHP ???? ?? ?? ???

??? ??? ????? ???? PHP ???? ?? ?? ???

Jul 25, 2016 am 08:44 AM

斷點續(xù)傳, PHP

PHP ???? ?? ?? ???, ??? ?? ???? ??, ???? ?? ?? ??? ???? ????. ????? ?? HTTP ????? ???? ??? ???????. HTTP1.1 ????? ??? ?? ? ??? ????? ?? ???? ???. ??? ??? ??? ?? ? feof? ???? ?? ??? ? ????. ??? ??? ?? ??? ?????? ?????.

  1. /**
  2. * ?? ?? ????? ??? ??? ?????
  3. */
  4. class HttpDownload {
  5. private $m_url = "";
  6. private $m_urlpath = "";
  7. ?? $m_scheme = "http";
  8. ?? $m_host = "";
  9. ?? $m_port = "80";
  10. ?? $m_user = "";
  11. ?? $ m_pass = "";
  12. ??? $m_path = "/";
  13. ??? $m_query = "";
  14. ??? $m_fp = "";
  15. ??? $m_error = "";
  16. ??? $m_httphead = "" ;
  17. ??? $m_html = "";
  18. /**
  19. * ???
  20. */
  21. ?? ?? PrivateInit($url){
  22. $urls = "";
  23. $urls = @parse_url($url);
  24. $this->m_url = $url;
  25. if(is_array($urls)) {
  26. $this->m_host = $urls ["???"];
  27. if(!empty($urls["scheme"])) $this->m_scheme = $urls["scheme"];
  28. if(!empty($urls[" user"])) $this->m_user = $urls["user"];
  29. if(!empty($urls["pass"])) $this->m_pass = $urls["pass" ];
  30. if(!empty($urls["port"])) $this->m_port = $urls["port"];
  31. if(!empty($urls["path"]) ) $this->m_path = $urls["path"];
  32. $this->m_urlpath = $this->m_path;
  33. if(!empty($urls["query"])) {
  34. $this->m_query = $urls["query"];
  35. $this->m_urlpath .= "?".$this->m_query;
  36. }
  37. }
  38. }
  39. /**
  40. * ??? URL? ???
  41. */
  42. function OpenUrl($url) {
  43. # 重設各參數(shù)
  44. $this->m_url = "";
  45. $this->m_urlpath = "";
  46. $this->m_scheme = "http";
  47. $this->m_host = "";
  48. $this->m_port = "80 ";
  49. $this->m_user = "";
  50. $this->m_pass = "";
  51. $this->m_path = "/";
  52. $this-> m_query = "";
  53. $this->m_error = "";
  54. $this->m_httphead = "" ;
  55. $this->m_html = "";
  56. $this- >Close();
  57. #初始化系統(tǒng)
  58. $this->PrivateInit($url);
  59. $this->PrivateStartSession();
  60. }
  61. /* *
  62. * ?? ??? ?? ??
  63. */
  64. ?? ?? printError() {
  65. echo "錯誤信息:".$this->m_error;
  66. echo "具體返回頭:
    ";
  67. foreach($this->m_httphead as $k=>$v) {
  68. echo "$k => $v
    rn";
  69. }
  70. }
  71. /**
  72. * Get ???? ???? ?? ??? ?? ??? ???? ??
  73. */
  74. ?? ?? IsGetOK() {
  75. if( ereg("^2 ",$this->GetHead("http-state")) ) {
  76. return true;
  77. } else {
  78. $this->m_error .= $this->GetHead("http -??")." - ".$this->GetHead("http-describe")."
    ";
  79. return false;
  80. }
  81. }
  82. /**
  83. * ??? ????? ??? ???? ??
  84. */
  85. ?? ?? IsText() {
  86. if (ereg("^2",$this->GetHead("http-state")) && eregi("^text",$this-> GetHead("content-type"))) {
  87. return true;
  88. } else {
  89. $this->m_error .= "內容為無文本類型
    ";
  90. return false;
  91. }
  92. }
  93. /**
  94. * ??? ????? ?? ???? ??
  95. */
  96. ?? ?? IsContentType($ctype) {
  97. if (ereg("^2",$this->GetHead ("http-state")) && $this->GetHead("content-type") == strtolower($ctype)) {
  98. return true
  99. } else {
  100. $this-> ;m_error .= "類型不對 ".$this->GetHead("content-type")."
    ";
  101. return false;
  102. }
  103. }
  104. /**
  105. * HTTP ????? ???? ?? ????
  106. */
  107. ?? ?? SaveToBin($savefilename) {
  108. if (!$this->IsGetOK()) return false;
  109. if (@feof($this-> m_fp)) {
  110. $this->m_error = "連接已經關閉!"
  111. return false;
  112. }
  113. $fp = fopen($savefilename,"w") ?? die("寫入文件 $savefilename 失敗!");
  114. while (!feof($this->m_fp)) {
  115. @fwrite($fp,fgets($this->m_fp,256));
  116. }
  117. @ fclose( $this->m_fp);
  118. return true;
  119. }
  120. /**
  121. * 儲存網頁內容為 Text 檔案
  122. */
  123. public function SaveToText($savefilename) {
  124. if ( $this- >IsText()) {
  125. $this->SaveBinFile($savefilename);
  126. } else {
  127. return "";
  128. }
  129. }
  130. /**
  131. * 用 HTTP 協(xié)定取得一個網頁的內容
  132. */
  133. public function GetHtml() {
  134. if (!$this->IsText()) return "";
  135. if ($this->m_html!= "") return $this- >m_html;
  136. if (!$this->m_fp||@feof($this->m_fp)) return "";
  137. while(!feof($this ->m_fp)) {
  138. $ this->m_html .= fgets($this->m_fp,256);
  139. }
  140. @fclose($this->m_fp);
  141. return $this->m_html;
  142. }
  143. }
  144. /**
  145. * 開始 HTTP 會話
  146. */
  147. public function PrivateStartSession() {
  148. if (!$this->PrivateOpenHost() ) {
  149. $this->m_error .= "開啟遠端主機錯誤! ";
  150. } else {
  151. $httpv = "HTTP/1.0";
  152. }
  153. fputs($this->m_fp,"GET ".$this->m_urlpath."$httpvrn") ;
  154. fputs($this->m_fp,"主機:".$this->m_host."rn");
  155. fputs($this->m_fp,"接受:*/*rn");
  156. fputs($this->m_fp,"用戶代理:Mozilla/4.0(相容;MSIE 6.0;Windows NT 5.2)rn");
  157. #HTTP1.1協(xié)定必須指定文件結束後關閉鏈接,否則讀取文件時無法使用feof判斷結束
  158. if ($httpv=="HTTP/1.1") {
  159. fputs($this->m_fp,"連接: Closernrn");
  160. } else {
  161. fputs($this->m_fp,"rn");
  162. }
  163. $ httpsstas = fgets($this->m_fp,256);
  164. $httpsstas = split(" ",$httpsstas);
  165. $this->m_httphead["http-edition"] = trim($httpsstas [0]);
  166. $this->m_httphead["http-state"] = trim($httpsstas[1]);
  167. $this->m_httphead["http-describe"] = "" ;
  168. for ($i=2;$i $this->m_httphead[ "http-describe"] .= " ".trim($httpsstas[ $i]);
  169. }
  170. while (!feof($this->m_fp)) {
  171. $line = str_replace(" "","",trim(fgets($this->m_fp) m_fp,256)));
  172. if($line == "") break;
  173. if (ereg(":",$line )) {
  174. $lines = split(":",$ line);
  175. $this->m_httphead[strtolower(trim($lines[0]))] = trim($lines[1]);
  176. }
  177. }
  178. }
  179. /**
  180. * 得到一個Http頭的值
  181. */
  182. public function GetHead($headname) {
  183. $headname = strtolower($headname);
  184. if (isset($this->m_httphead[$headname) ])) {
  185. return $this->m_httphead[$headname];
  186. } else {
  187. return "";
  188. }
  189. }
  190. /**
  191. * 開啟連線
  192. */
  193. public function PrivateOpenHost() {
  194. if ($this->m_host=="") return false;
  195. $this ->m_fp = @fsockopen($this->m_fp; m_host, $this->m_port, &$errno, &$errstr,10);
  196. if (!$this->m_fp){
  197. $this->m_error = $errstr;
  198. return false;
  199. } else {
  200. return true;
  201. }
  202. }
  203. /**
  204. * 關閉連線
  205. */
  206. public function Close(){
  207. @ fclose($ this->m_fp);
  208. }
  209. }
  210. # 兩種使用方法,分別如下:
  211. #開啟網頁
  212. $httpdown = new HttpDownload ();
  213. $httpdown->OpenUrl("http://www.google.com.hk");
  214. echo $httpdown->GetHtml();
  215. $httpdown->關閉();
  216. #下載檔案
  217. $file = new HttpDownload(); # 實例化類別
  218. $file->OpenUrl("http://www.ti.com.cn/cn/lit/an/rust020/rust020.pdf"); # 遠端檔案位址
  219. $file->SaveToBin("rust020.pdf"); # 儲存路徑及檔名
  220. $file->Close(); # 釋放資源
  221. ?>
  222. 複製程式碼

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1601
29
PHP ????
1502
276
???
PHP ?? ??? ??????? PHP ?? ??? ??????? Jul 17, 2025 am 04:16 AM

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP?? ?? ???? ???? ???? ??? ?????? PHP?? ?? ???? ???? ???? ??? ?????? Jul 08, 2025 am 02:37 AM

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP?? ?? ?? PHP?? ?? ?? Jul 18, 2025 am 04:57 AM

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

PHP?? ???? ??? ?????? PHP?? ???? ??? ?????? Jul 11, 2025 am 03:12 AM

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

PHP ?? ?? ? PHP ?? ?? ? Jul 18, 2025 am 04:51 AM

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

?? PHP : ??? ??? ?? PHP : ??? ??? Jul 18, 2025 am 04:54 AM

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled

PHP?? ??? ? ???? ??? ????? ?? PHP?? ??? ? ???? ??? ????? ?? Jul 12, 2025 am 03:15 AM

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.

?? PHP ?? ??? ?? PHP ?? ??? Jul 18, 2025 am 04:52 AM

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

See all articles