目录
回复讨论(解决方案)
首页 后端开发 php教程 200分求助CURL设置HTTPHEADER上传文件问题!

200分求助CURL设置HTTPHEADER上传文件问题!

Jun 23, 2016 pm 02:20 PM

哪位大侠有使用CURL设置HTTPHEADER来上传文件的经验?

求指点

PS:不是 '@'.文件名,而是Content-Type: application/octet-stream


回复讨论(解决方案)

curl不支持这种方式,你需要自己构造数据包。我研究过

curl不支持这种方式,你需要自己构造数据包。我研究过

是否有示例?

http://cn.php.net/fsockopen
CTRL + F搜索boundary,例子好好看看,构建一个文件上传的http请求头即可,按理说CURL构建同样的请求头应该也没问题。

总结一下项目中用到curl的几种方式 
1. php curl的默认调用方法,get方式访问url 
Java代码 
....   
    $ch = curl_init();   
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);    //设置http头   
    curl_setopt($ch, CURLOPT_ENCODING, "gzip" );         //设置为客户端支持gzip压缩   
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30 );  //设置连接等待时间   
    curl_setopt($ch, CURLOPT_URL, $url );   
    curl_exec( $ch );   
    if ($error = curl_error($ch) ) {   
        //出错处理   
        return -1;   
    }   
    fclose($fp);     
  
    $curl_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);        //获取http返回值   
    if( $curl_code == 200 ) {   
        //正常访问url   
    }   
    //异常   
....  

....
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);    //设置http头
    curl_setopt($ch, CURLOPT_ENCODING, "gzip" );         //设置为客户端支持gzip压缩
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30 );  //设置连接等待时间
    curl_setopt($ch, CURLOPT_URL, $url );
    curl_exec( $ch );
    if ($error = curl_error($ch) ) {
        //出错处理
        return -1;
    }
    fclose($fp);  

    $curl_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);        //获取http返回值
    if( $curl_code == 200 ) {
        //正常访问url
    }
    //异常
....
2. 设置http header支持curl访问lighttpd服务器 
Java代码 
$header[]= 'Expect:';     

$header[]= 'Expect:';   
3. 设置curl,只获取http header,不获取body: 
Java代码 
curl_setopt($ch, CURLOPT_HEADER, 1);     
curl_setopt($ch, CURLOPT_NOBODY, 1);     

curl_setopt($ch, CURLOPT_HEADER, 1);  
curl_setopt($ch, CURLOPT_NOBODY, 1);   
或者只获取body: 
Java代码 
curl_setopt($ch, CURLOPT_HEADER, 0);   // make sure we get the body   
curl_setopt($ch, CURLOPT_NOBODY, 0);   

    curl_setopt($ch, CURLOPT_HEADER, 0);   // make sure we get the body
    curl_setopt($ch, CURLOPT_NOBODY, 0); 
4. 访问虚拟主机,需设置Host 
$header[]= 'Host: '.$host;  
5. 使用post, put, delete等REStful方式访问url 
post: 
    curl_setopt($ch, CURLOPT_POST, 1 ); 
put, delete: 
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");  //或者PUT,需要服务器支持这些方法。 
6. 保存下载内容为文件 
    curl_setopt($ch, CURLOPT_FILE, $fp); 

总结一下项目中用到curl的几种方式 
1. php curl的默认调用方法,get方式访问url 
Java代码 
....   
    $ch = curl_init();   
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);    //设置http头   
    curl_setopt($ch, CURLOPT_ENCO……

貌似没看到使用了CURLOPT_HTTPHEADER

http://cn.php.net/fsockopen
CTRL + F搜索boundary,例子好好看看,构建一个文件上传的http请求头即可,按理说CURL构建同样的请求头应该也没问题。

谢谢,CURL不支持这种上传方法吗?

可能是比较复杂吧,所以 curl 提供了 '@'.文件名 的方式。把构造头和数据的工作留给了自己

但 curl 依然提供了 CURLOPT_UPLOAD 来表示上传文件,但实际上使用了 PUT 请求
只适合向 ftp 上传文件
在 php 中,要从 php://input 读取

使用 #5 给出的代码,会产生 无法识别的请求 这样的错误,注释掉文件上传的那段,依然报这个错。不知是什么原因
但对比 curl PUT 方式的数据报,似乎也没有什么差异

知道了,这样写就可以!

$contents =<<< 'TEXT'数据报中应该是Content-Disposition: form-data; name="userfile"; filename="file_name"Content-Type: 文档类型文件内容这样的格式,我只实现了文件名部分,文档类型不知道如何实现。这样上传后就取不到 type 的值curl_upload_server.php<xmp><?phpprint_r($_FILES);echo "文件内容:\n";$p = current($_FILES);readfile($p['tmp_name']);TEXT;$fields['f"; filename="x.x'] = $contents; //这个关联键的写法很怪异吧?$ch = curl_init();  curl_setopt($ch, CURLOPT_URL,"http://localhost/curl_upload_server.php");  curl_setopt($ch, CURLOPT_POST, 1 );curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$s = curl_exec ($ch);  curl_close ($ch);  echo $s;
登录后复制

原来这样就有 type了

$varname = 'my';$name = '3.txt';$type = 'text/plain';$key = <<< TEXT$varname"; filename="$nameContent-Type: $typeTEXT;$fields[$key] = $contents;
登录后复制

注意:我是在 win 下的,linux 下要将 \n 换成 \r\n
没办法,早年的 sun 是拼不过 ms 的,现在也不行吧?

一直以为上传的文件类型是 php 识别的,却原来是浏览器提供的

原来这样就有 type了PHP code
$varname = 'my';
$name = '3.txt';
$type = 'text/plain';
$key = <<< TEXT
$varname"; filename="$name
Content-Type: $type

TEXT;
$fields[$key] = $contents;


注意:我是在 win 下的,linux 下……

很感谢,有没有比较完整的CURL 通过拼接HTTPHEADER信息上传的POST示例呢?

#10 就是
curl_upload_server.php 就是测试用服务器端

<br /> <?php <br /> print_r($_FILES); <br /> <br /> echo "文件内容:\n"; <br /> $p = current($_FILES); <br /> readfile($p['tmp_name']); <br /> </p> <p class="sougouAnswer"> <p class="modified_message"> 本帖最后由 xuzuning 于 2012-04-10 13:19:42 编辑 </p> 完整的代码 <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'>$contents =&lt;&lt;&lt; 'TEXT'数据报中应该是Content-Disposition: form-data; name=&quot;userfile&quot;; filename=&quot;file_name&quot;Content-Type: 文档类型文件内容这样的格式以下是服务器端代码curl_upload_server.php&lt;xmp&gt;&lt;?phpprint_r($_FILES); //检查上传信息echo &quot;文件内容:\n&quot;;$p = current($_FILES);readfile($p['tmp_name']); //输出上传的文件TEXT;$varname = 'my';$name = '3.txt';$type = 'text/plain';$key = &quot;$varname\&quot;; filename=\&quot;$name\r\nContent-Type: $type\r\n&quot;;$fields[$key] = $contents;$ch = curl_init(); curl_setopt($ch, CURLOPT_URL,&quot;http://localhost/curl_upload_server.php&quot;); curl_setopt($ch, CURLOPT_POST, 1 );curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$s = curl_exec ($ch); curl_close ($ch); echo $s;</pre><div class="contentsignin">登录后复制</div></div> </p> <p class="sougouAnswer"> http文件上传协议,主要是那个boundary,这个东西就是标识一个文件的内容和类型以及各种上传参数的token,其它和普通的POST提交也没啥区别。 <br /> <br /> fsockopen来写http请求就比较直白,用curl的话模拟对应的请求头和body就好了。 <br /> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'>&lt;?php//what file you want to upload$uploadFile = file_get_contents(&quot;/var/www/index.html&quot;);//content boundary $boundary = md5(time());$postStr = &quot;&quot;;$postStr .=&quot;--&quot;.$boundary.&quot;\r\n&quot;;$postStr .=&quot;Content-Disposition: form-data; name=\&quot;uptxt\&quot;; filename=\&quot;index.html\&quot;\r\n&quot;;$postStr .=&quot;Content-Type: text/html\r\n\r\n&quot;;$postStr .=$uploadFile.&quot;\r\n&quot;;$postStr .=&quot;--&quot;.$boundary.&quot;\r\n&quot;; /** use fsockopen to set upload http header and body **/$fp = fsockopen(&quot;localhost&quot;,&quot;80&quot;,$errer,$errno,1);fwrite($fp,&quot;POST /upload.php HTTP/1.0\r\n&quot;);fwrite($fp,&quot;Content-Type: multipart/form-data; boundary=&quot;.$boundary.&quot;\r\n&quot;);fwrite($fp,&quot;Content-length:&quot;.strlen($postStr).&quot;\r\n\r\n&quot;);fwrite($fp,$postStr);while (!feof($fp)){ echo fgets($fp, 128);}fclose($fp);/** use curl instead **/$cl = curl_init('http://localhost/upload.php');$boundary = md5(time());curl_setopt($cl,CURLOPT_POST,true);curl_setopt($cl,CURLOPT_HTTPHEADER,array( &quot;Content-Type: multipart/form-data; boundary=&quot;.$boundary));curl_setopt($cl,CURLOPT_POSTFIELDS,$postStr);curl_setopt($cl,CURLOPT_RETURNTRANSFER,true);$content = curl_exec($cl);curl_close($cl);echo $content;?&gt;</pre><div class="contentsignin">登录后复制</div></div> <br /> <br /> upload.php <br /> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'>&lt;?php print_r($_FILES);?&gt;</pre><div class="contentsignin">登录后复制</div></div> <br /> <br /> 结果 <br /> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'>HTTP/1.1 200 OKServer: nginx/0.8.54Date: Tue, 10 Apr 2012 05:22:01 GMTContent-Type: text/htmlConnection: closeX-Powered-By: PHP/5.3.10Array( [uptxt] =&gt; Array ( [name] =&gt; index.html [type] =&gt; text/html [tmp_name] =&gt; /tmp/phpKHfxkY [error] =&gt; 0 [size] =&gt; 344 ))Array( [uptxt] =&gt; Array ( [name] =&gt; index.html [type] =&gt; text/html [tmp_name] =&gt; /tmp/phpB0se13 [error] =&gt; 0 [size] =&gt; 344 ))</pre><div class="contentsignin">登录后复制</div></div> <br /> <br /> <br /> <br /> </p> <p class="sougouAnswer"> 完整的代码PHP code <br /> $contents =<<< 'TEXT' <br /> 数据报中应该是 <br /> Content-Disposition: form-data; name="userfile"; filename="file_name" <br /> Content-Type: 文档类型 <br /> <br /> 文件内容 <br /> <br /> 这样的格式 <br /> 以下是服务器端代码 <br /> curl_upload_server.php <br /> <xmp> <br /> <?php <br /> print_r(…… <br /> <br /> 没有client? </p> <p class="sougouAnswer"> 完整的代码PHP code <br /> $contents =<<< 'TEXT' <br /> 数据报中应该是 <br /> Content-Disposition: form-data; name="userfile"; filename="file_name" <br /> Content-Type: 文档类型 <br /> <br /> 文件内容 <br /> <br /> 这样的格式 <br /> 以下是服务器端代码 <br /> curl_upload_server.php <br /> <xmp> <br /> <?php <br /> print_r(…… <br /> <br /> 最好能分开发一下,谢谢 </p> <p class="sougouAnswer"> http文件上传协议,主要是那个boundary,这个东西就是标识一个文件的内容和类型以及各种上传参数的token,其它和普通的POST提交也没啥区别。 <br /> <br /> fsockopen来写http请求就比较直白,用curl的话模拟对应的请求头和body就好了。 <br /> PHP code <br /> <?php <br /> //what file you want to upload <br /> $uploadFile = file_get_…… <br /> <br /> 非常感谢,CURL部分的代码我这边测试成功了,我再加一百分 </p> <p class="sougouAnswer"> #14 服务器端 <br /> #15 客户端 <br /> <br /> #14 中的 $contents 是待上传的文件内容 </p> <p class="sougouAnswer"> 上次好像看到你问的是一个文件切分多份,然后上传,如果是这样的话,你要要做的只是用boundary标识多个上传内容区块。比如 <br /> <div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'>$boundary = md5(time());$postStr = &quot;&quot;;$postStr .=&quot;--&quot;.$boundary.&quot;\r\n&quot;;$postStr .=&quot;Content-Disposition: form-data; name=\&quot;uptxt[]\&quot;; filename=\&quot;index_1.html\&quot;\r\n&quot;;$postStr .=&quot;Content-Type: text/html\r\n\r\n&quot;;$postStr .=$uploadFile.&quot;\r\n&quot;; #这里是部分文件内容$postStr .=&quot;--&quot;.$boundary.&quot;\r\n&quot;;$postStr .=&quot;--&quot;.$boundary.&quot;\r\n&quot;;$postStr .=&quot;Content-Disposition: form-data; name=\&quot;uptxt[]\&quot;; filename=\&quot;index_2.html\&quot;\r\n&quot;; $postStr .=&quot;Content-Type: text/html\r\n\r\n&quot;;$postStr .=$uploadFile.&quot;\r\n&quot;;#这里是部分文件内容$postStr .=&quot;--&quot;.$boundary.&quot;\r\n&quot;;</pre><div class="contentsignin">登录后复制</div></div> <br> </p> <p class="sougouAnswer"> 收藏了! </p> <p class="sougouAnswer"> to #21 <br> 你这样做是不行的,应该使用 curl_multi 并发 <br> 不然把一个文件拆成几个, 一次性传出,再在服务器端组装。有什么意义? <br> </p> <p class="sougouAnswer"> 上次好像看到你问的是一个文件切分多份,然后上传,如果是这样的话,你要要做的只是用boundary标识多个上传内容区块。比如 <br> PHP code <br> $boundary   = md5(time()); <br> $postStr  = ""; <br> $postStr .="--".$boundary."\r\n"; <br> $postStr .="Content-Disposition: form-data; name=…… <br> <br> 我用了个循环来做 </p> <p class="sougouAnswer"> 引用 21 楼  的回复: <br> <br> 上次好像看到你问的是一个文件切分多份,然后上传,如果是这样的话,你要要做的只是用boundary标识多个上传内容区块。比如 <br> PHP code <br> $boundary   = md5(time()); <br> $postStr  = ""; <br> $postStr .="--".$boundary."\r\n"; <br> $postStr .="Content-Dispositi…… <br> <br> 感谢,curl_multi很有用 </p> <p class="sougouAnswer"> to #21 <br> 你这样做是不行的,应该使用 curl_multi 并发 <br> 不然把一个文件拆成几个,一次性传出,再在服务器端组装。有什么意义? <br> 说的也是哈,不过curl_multi的并发,对于请求不同的url后获取数据比较有意义,就是说是并行请求不同的url获取http返回。如果往同一url请求,要么就一次请求,要么就分发多次请求,多次请求有个性能消耗在于每次都要scoket连接/销毁,但是能控制请求字节数。 </p> <p class="sougouAnswer"> 引用 23 楼  的回复: <br> <br> to #21 <br> 你这样做是不行的,应该使用 curl_multi 并发 <br> 不然把一个文件拆成几个,一次性传出,再在服务器端组装。有什么意义? <br> <br> 说的也是哈,不过curl_multi的并发,对于请求不同的url后获取数据比较有意义,就是说是并行请求不同的url获取http返回。如果往同一url请求,要么就一次请求,要么就分发多次请求,多次请求有个性能消耗在于每…… <br> 忘了如果服务器支持keep-alive的话,无需进行多次socket create,呵呵 </p> <p class="sougouAnswer"> 一路上传不能充分利用网络资源,多路并发可使上传速度加快 <br> </p> <p class="sougouAnswer"> 引用 26 楼  的回复: <br> <br> 引用 23 楼  的回复: <br> <br> to #21 <br> 你这样做是不行的,应该使用 curl_multi 并发 <br> 不然把一个文件拆成几个,一次性传出,再在服务器端组装。有什么意义? <br> <br> 说的也是哈,不过curl_multi的并发,对于请求不同的url后获取数据比较有意义,就是说是并行请求不同的url获取http返回。如果往同一url请求,要么就一次请求,要么就分发多…… <br> <br> 嗯,基本上都支持keep-alive了 </p> <p class="sougouAnswer"> 一路上传不能充分利用网络资源,多路并发可使上传速度加快 <br> <br> 嗯,网络利用率更高 </p> <p class="sougouAnswer"> CSDN的编辑器还是没改进,同时回复多个还需要手动复制代码。。。 </p> <p class="sougouAnswer"> 嗯,服务器可开多线程/进程处理你的并发上传请求,这是快的缘故。 </p> <p class="sougouAnswer"> 只要资源够,多开几路并无大碍,至多大部被阻塞了,就相当于单路 <br> 设计成多路传输的好处还有,当某段数据传输失败时,可以重传这段。 <br> 这是单路传输设计做不到的 </p> <p class="sougouAnswer"> http://cn.php.net/fsockopen <br> CTRL + F搜索boundary,例子好好看看,构建一个文件上传的http请求头即可,按理说CURL构建同样的请求头应该也没问题。 <br> <br> 照着PHP手册里去做反而没成功 </p> <p class="sougouAnswer"> 引用 5 楼  的回复: <br> <br> http://cn.php.net/fsockopen <br> CTRL + F搜索boundary,例子好好看看,构建一个文件上传的http请求头即可,按理说CURL构建同样的请求头应该也没问题。 <br> <br> <br> 照着PHP手册里去做反而没成功 <br> 是吗?你不如用wireshark,smartsniff等工具查看http请求格式(firebug或者chrome自带的F12应该也可以),执行一次上传文件动作,然后观察文件上传时的http请求格式。 </p> <p class="sougouAnswer"> 贴个post的socket代码: <br> 我测试过的备份! <br> <br> http://webinno.cn/blog/article/view/40 <br> <br> </p> <p class="sougouAnswer"> CURLOPT_HEADERFUNCTION这个参数可以设置HTTP协议回调,你可以参考下 </p> <p class="sougouAnswer"> curl只要你设置些参数,然后他自己会生成协议头提交服务器 </p> <p class="sougouAnswer"> 谢谢大家! </p> <p class="sougouAnswer"> 我只用过Content-Type提供下载. </p> <p class="sougouAnswer"> 不错!!!!!! </p> <p class="sougouAnswer"> 我也要一份 </p> </div> </div> <div class="wzconShengming_sp"> <div class="bzsmdiv_sp">本站声明</div> <div>本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn</div> </div> </div> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-5902227090019525" data-ad-slot="2507867629"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <div class="AI_ToolDetails_main4sR"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-5902227090019525" data-ad-slot="3653428331" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <!-- <div class="phpgenera_Details_mainR4"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>热门文章</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796780570.html" title="R.E.P.O.能量晶体解释及其做什么(黄色晶体)" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.能量晶体解释及其做什么(黄色晶体)</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 周前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796780641.html" title="R.E.P.O.最佳图形设置" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.最佳图形设置</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 周前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796785841.html" title="刺客信条阴影:贝壳谜语解决方案" class="phpgenera_Details_mainR4_bottom_title">刺客信条阴影:贝壳谜语解决方案</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>2 周前</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796780520.html" title="R.E.P.O.如果您听不到任何人,如何修复音频" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.如果您听不到任何人,如何修复音频</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 周前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796779766.html" title="WWE 2K25:如何解锁Myrise中的所有内容" class="phpgenera_Details_mainR4_bottom_title">WWE 2K25:如何解锁Myrise中的所有内容</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 周前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/zh/article.html">显示更多</a> </div> </div> </div> --> <div class="phpgenera_Details_mainR3"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hottools2.png" alt="" /> <h2>热AI工具</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411540686492.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undresser.AI Undress" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/ai/undresserai-undress" title="Undresser.AI Undress" class="phpmain_tab2_mids_title"> <h3>Undresser.AI Undress</h3> </a> <p>人工智能驱动的应用程序,用于创建逼真的裸体照片</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411552797167.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Clothes Remover" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/ai/ai-clothes-remover" title="AI Clothes Remover" class="phpmain_tab2_mids_title"> <h3>AI Clothes Remover</h3> </a> <p>用于从照片中去除衣服的在线人工智能工具。</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173410641626608.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Undress AI Tool" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/ai/undress-ai-tool" title="Undress AI Tool" class="phpmain_tab2_mids_title"> <h3>Undress AI Tool</h3> </a> <p>免费脱衣服图片</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173411529149311.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="Clothoff.io" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/ai/clothoffio" title="Clothoff.io" class="phpmain_tab2_mids_title"> <h3>Clothoff.io</h3> </a> <p>AI脱衣机</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/ai/ai-hentai-generator" title="AI Hentai Generator" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/ai_manual/001/246/273/173405034393877.jpg?x-oss-process=image/resize,m_fill,h_50,w_50" src="/static/imghw/default1.png" alt="AI Hentai Generator" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/ai/ai-hentai-generator" title="AI Hentai Generator" class="phpmain_tab2_mids_title"> <h3>AI Hentai Generator</h3> </a> <p>免费生成ai无尽的。</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/zh/ai">显示更多</a> </div> </div> </div> <script src="https://sw.php.cn/hezuo/cac1399ab368127f9b113b14eb3316d0.js" type="text/javascript"></script> <div class="phpgenera_Details_mainR4"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>热门文章</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796780570.html" title="R.E.P.O.能量晶体解释及其做什么(黄色晶体)" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.能量晶体解释及其做什么(黄色晶体)</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 周前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796780641.html" title="R.E.P.O.最佳图形设置" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.最佳图形设置</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 周前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796785841.html" title="刺客信条阴影:贝壳谜语解决方案" class="phpgenera_Details_mainR4_bottom_title">刺客信条阴影:贝壳谜语解决方案</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>2 周前</span> <span>By DDD</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796780520.html" title="R.E.P.O.如果您听不到任何人,如何修复音频" class="phpgenera_Details_mainR4_bottom_title">R.E.P.O.如果您听不到任何人,如何修复音频</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 周前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/1796779766.html" title="WWE 2K25:如何解锁Myrise中的所有内容" class="phpgenera_Details_mainR4_bottom_title">WWE 2K25:如何解锁Myrise中的所有内容</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <span>3 周前</span> <span>By 尊渡假赌尊渡假赌尊渡假赌</span> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/zh/article.html">显示更多</a> </div> </div> </div> <div class="phpgenera_Details_mainR3"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hottools2.png" alt="" /> <h2>热工具</h2> </div> <div class="phpgenera_Details_mainR3_bottom"> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/toolset/development-tools/92" title="记事本++7.3.1" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab96f0f39f7357.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="记事本++7.3.1" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/toolset/development-tools/92" title="记事本++7.3.1" class="phpmain_tab2_mids_title"> <h3>记事本++7.3.1</h3> </a> <p>好用且免费的代码编辑器</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/toolset/development-tools/93" title="SublimeText3汉化版" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab97a3baad9677.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3汉化版" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/toolset/development-tools/93" title="SublimeText3汉化版" class="phpmain_tab2_mids_title"> <h3>SublimeText3汉化版</h3> </a> <p>中文版,非常好用</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/toolset/development-tools/121" title="禅工作室 13.0.1" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58ab97ecd1ab2670.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="禅工作室 13.0.1" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/toolset/development-tools/121" title="禅工作室 13.0.1" class="phpmain_tab2_mids_title"> <h3>禅工作室 13.0.1</h3> </a> <p>功能强大的PHP集成开发环境</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58d0e0fc74683535.jpg?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="Dreamweaver CS6" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/toolset/development-tools/469" title="Dreamweaver CS6" class="phpmain_tab2_mids_title"> <h3>Dreamweaver CS6</h3> </a> <p>视觉化网页开发工具</p> </div> </div> <div class="phpmain_tab2_mids_top"> <a href="https://www.php.cn/zh/toolset/development-tools/500" title="SublimeText3 Mac版" class="phpmain_tab2_mids_top_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" class="lazy" data-src="https://img.php.cn/upload/manual/000/000/001/58d34035e2757995.png?x-oss-process=image/resize,m_fill,h_50,w_72" src="/static/imghw/default1.png" alt="SublimeText3 Mac版" /> </a> <div class="phpmain_tab2_mids_info"> <a href="https://www.php.cn/zh/toolset/development-tools/500" title="SublimeText3 Mac版" class="phpmain_tab2_mids_title"> <h3>SublimeText3 Mac版</h3> </a> <p>神级代码编辑软件(SublimeText3)</p> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/zh/ai">显示更多</a> </div> </div> </div> <div class="phpgenera_Details_mainR4"> <div class="phpmain1_4R_readrank"> <div class="phpmain1_4R_readrank_top"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/hotarticle2.png" alt="" /> <h2>热门话题</h2> </div> <div class="phpgenera_Details_mainR4_bottom"> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/gmailyxdlrkzn" title="gmail邮箱登陆入口在哪里" class="phpgenera_Details_mainR4_bottom_title">gmail邮箱登陆入口在哪里</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>7467</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>15</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/cakephp-tutor" title="CakePHP 教程" class="phpgenera_Details_mainR4_bottom_title">CakePHP 教程</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>1376</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>52</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/steamdzhmcssmgs" title="steam的账户名称是什么格式" class="phpgenera_Details_mainR4_bottom_title">steam的账户名称是什么格式</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>77</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>11</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/winactivationkeyper" title="win11激活密钥永久" class="phpgenera_Details_mainR4_bottom_title">win11激活密钥永久</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>48</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>19</span> </div> </div> </div> <div class="phpgenera_Details_mainR4_bottoms"> <a href="https://www.php.cn/zh/faq/newyorktimesdailybrief" title="NYT连接提示和答案" class="phpgenera_Details_mainR4_bottom_title">NYT连接提示和答案</a> <div class="phpgenera_Details_mainR4_bottoms_info"> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/eyess.png" alt="" /> <span>19</span> </div> <div class="phpgenera_Details_mainR4_bottoms_infos"> <img src="/static/imghw/tiezi.png" alt="" /> <span>20</span> </div> </div> </div> </div> <div class="phpgenera_Details_mainR3_more"> <a href="https://www.php.cn/zh/faq/zt">显示更多</a> </div> </div> </div> </div> </div> <div class="Article_Details_main2"> <div class="phpgenera_Details_mainL4"> <div class="phpmain1_2_top"> <a href="javascript:void(0);" class="phpmain1_2_top_title">Related knowledge<img src="/static/imghw/index2_title2.png" alt="" /></a> </div> <div class="phpgenera_Details_mainL4_info"> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/zh/faq/1796778251.html" title="在Laravel中使用Flash会话数据" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174177050399455.png?x-oss-process=image/resize,m_fill,h_207,w_330" alt="在Laravel中使用Flash会话数据" /> </a> <a href="https://www.php.cn/zh/faq/1796778251.html" title="在Laravel中使用Flash会话数据" class="phphistorical_Version2_mids_title">在Laravel中使用Flash会话数据</a> <span class="Articlelist_txts_time">Mar 12, 2025 pm 05:08 PM</span> <p class="Articlelist_txts_p">Laravel使用其直观的闪存方法简化了处理临时会话数据。这非常适合在您的应用程序中显示简短的消息,警报或通知。 默认情况下,数据仅针对后续请求: $请求 - </p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/zh/faq/1796779059.html" title="php中的卷曲:如何在REST API中使用PHP卷曲扩展" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/000/000/080/67d3a4f0ef568156.png?x-oss-process=image/resize,m_fill,h_207,w_330" alt="php中的卷曲:如何在REST API中使用PHP卷曲扩展" /> </a> <a href="https://www.php.cn/zh/faq/1796779059.html" title="php中的卷曲:如何在REST API中使用PHP卷曲扩展" class="phphistorical_Version2_mids_title">php中的卷曲:如何在REST API中使用PHP卷曲扩展</a> <span class="Articlelist_txts_time">Mar 14, 2025 am 11:42 AM</span> <p class="Articlelist_txts_p">PHP客户端URL(curl)扩展是开发人员的强大工具,可以与远程服务器和REST API无缝交互。通过利用Libcurl(备受尊敬的多协议文件传输库),PHP curl促进了有效的执行</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/zh/faq/1796787277.html" title="支付宝PHP SDK转账报错:如何解决'Cannot declare class SignData”问题?" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174303625625009.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="支付宝PHP SDK转账报错:如何解决'Cannot declare class SignData”问题?" /> </a> <a href="https://www.php.cn/zh/faq/1796787277.html" title="支付宝PHP SDK转账报错:如何解决'Cannot declare class SignData”问题?" class="phphistorical_Version2_mids_title">支付宝PHP SDK转账报错:如何解决'Cannot declare class SignData”问题?</a> <span class="Articlelist_txts_time">Apr 01, 2025 am 07:21 AM</span> <p class="Articlelist_txts_p">支付宝PHP...</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/zh/faq/1796778255.html" title="简化的HTTP响应在Laravel测试中模拟了" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/001/253/068/174177056555028.png?x-oss-process=image/resize,m_fill,h_207,w_330" alt="简化的HTTP响应在Laravel测试中模拟了" /> </a> <a href="https://www.php.cn/zh/faq/1796778255.html" title="简化的HTTP响应在Laravel测试中模拟了" class="phphistorical_Version2_mids_title">简化的HTTP响应在Laravel测试中模拟了</a> <span class="Articlelist_txts_time">Mar 12, 2025 pm 05:09 PM</span> <p class="Articlelist_txts_p">Laravel 提供简洁的 HTTP 响应模拟语法,简化了 HTTP 交互测试。这种方法显着减少了代码冗余,同时使您的测试模拟更直观。 基本实现提供了多种响应类型快捷方式: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' =&gt; 'Hello World', 'github.com' =&gt; ['foo' =&gt; 'bar'], 'forge.laravel.com' =&gt;</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/zh/faq/1796778636.html" title="在Codecanyon上的12个最佳PHP聊天脚本" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/001/242/473/174183889317163.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="在Codecanyon上的12个最佳PHP聊天脚本" /> </a> <a href="https://www.php.cn/zh/faq/1796778636.html" title="在Codecanyon上的12个最佳PHP聊天脚本" class="phphistorical_Version2_mids_title">在Codecanyon上的12个最佳PHP聊天脚本</a> <span class="Articlelist_txts_time">Mar 13, 2025 pm 12:08 PM</span> <p class="Articlelist_txts_p">您是否想为客户最紧迫的问题提供实时的即时解决方案? 实时聊天使您可以与客户进行实时对话,并立即解决他们的问题。它允许您为您的自定义提供更快的服务</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/zh/faq/1796782794.html" title="解释PHP中晚期静态结合的概念。" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/202503/21/2025032113332596253.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="解释PHP中晚期静态结合的概念。" /> </a> <a href="https://www.php.cn/zh/faq/1796782794.html" title="解释PHP中晚期静态结合的概念。" class="phphistorical_Version2_mids_title">解释PHP中晚期静态结合的概念。</a> <span class="Articlelist_txts_time">Mar 21, 2025 pm 01:33 PM</span> <p class="Articlelist_txts_p">文章讨论了PHP 5.3中引入的PHP中的晚期静态结合(LSB),从而允许静态方法的运行时分辨率调用以获得更灵活的继承。 LSB的实用应用和潜在的触摸</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/zh/faq/1796786131.html" title="自定义/扩展框架:如何添加自定义功能。" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/202503/28/2025032817124947598.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="自定义/扩展框架:如何添加自定义功能。" /> </a> <a href="https://www.php.cn/zh/faq/1796786131.html" title="自定义/扩展框架:如何添加自定义功能。" class="phphistorical_Version2_mids_title">自定义/扩展框架:如何添加自定义功能。</a> <span class="Articlelist_txts_time">Mar 28, 2025 pm 05:12 PM</span> <p class="Articlelist_txts_p">本文讨论了将自定义功能添加到框架上,专注于理解体系结构,识别扩展点以及集成和调试的最佳实践。</p> </div> <div class="phphistorical_Version2_mids"> <a href="https://www.php.cn/zh/faq/1796787536.html" title="如何用PHP的cURL库发送包含JSON数据的POST请求?" class="phphistorical_Version2_mids_img"> <img onerror="this.onerror=''; this.src='/static/imghw/default1.png'" src="/static/imghw/default1.png" class="lazy" data-src="https://img.php.cn/upload/article/001/246/273/174269580466138.jpg?x-oss-process=image/resize,m_fill,h_207,w_330" alt="如何用PHP的cURL库发送包含JSON数据的POST请求?" /> </a> <a href="https://www.php.cn/zh/faq/1796787536.html" title="如何用PHP的cURL库发送包含JSON数据的POST请求?" class="phphistorical_Version2_mids_title">如何用PHP的cURL库发送包含JSON数据的POST请求?</a> <span class="Articlelist_txts_time">Apr 01, 2025 pm 03:12 PM</span> <p class="Articlelist_txts_p">使用PHP的cURL库发送JSON数据在PHP开发中,经常需要与外部API进行交互,其中一种常见的方式是使用cURL库发送POST�...</p> </div> </div> <a href="https://www.php.cn/zh/be/" class="phpgenera_Details_mainL4_botton"> <span>See all articles</span> <img src="/static/imghw/down_right.png" alt="" /> </a> </div> </div> </div> </main> <footer> <div class="footer"> <div class="footertop"> <img src="/static/imghw/logo.png" alt=""> <p>公益在线PHP培训,帮助PHP学习者快速成长!</p> </div> <div class="footermid"> <a href="https://www.php.cn/zh/about/us.html">关于我们</a> <a href="https://www.php.cn/zh/about/disclaimer.html">免责声明</a> <a href="https://www.php.cn/zh/update/article_0_1.html">Sitemap</a> </div> <div class="footerbottom"> <p> © php.cn All rights reserved </p> </div> </div> </footer> <input type="hidden" id="verifycode" value="/captcha.html"> <script>layui.use(['element', 'carousel'], function () {var element = layui.element;$ = layui.jquery;var carousel = layui.carousel;carousel.render({elem: '#test1', width: '100%', height: '330px', arrow: 'always'});$.getScript('/static/js/jquery.lazyload.min.js', function () {$("img").lazyload({placeholder: "/static/images/load.jpg", effect: "fadeIn", threshold: 200, skip_invisible: false});});});</script> <script src="/static/js/common_new.js"></script> <script type="text/javascript" src="/static/js/jquery.cookie.js?1744419572"></script> <script src="https://vdse.bdstatic.com//search-video.v1.min.js"></script> <link rel='stylesheet' id='_main-css' href='/static/css/viewer.min.css?2' type='text/css' media='all' /> <script type='text/javascript' src='/static/js/viewer.min.js?1'></script> <script type='text/javascript' src='/static/js/jquery-viewer.min.js'></script> <script type="text/javascript" src="/static/js/global.min.js?5.5.53"></script> <script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function () { var u = "https://tongji.php.cn/"; _paq.push(['setTrackerUrl', u + 'matomo.php']); _paq.push(['setSiteId', '9']); var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s); })(); </script> <script> // top layui.use(function () { var util = layui.util; util.fixbar({ on: { mouseenter: function (type) { layer.tips(type, this, { tips: 4, fixed: true, }); }, mouseleave: function (type) { layer.closeAll("tips"); }, }, }); }); document.addEventListener("DOMContentLoaded", (event) => { // 定义一个函数来处理滚动链接的点击事件 function setupScrollLink(scrollLinkId, targetElementId) { const scrollLink = document.getElementById(scrollLinkId); const targetElement = document.getElementById(targetElementId); if (scrollLink && targetElement) { scrollLink.addEventListener("click", (e) => { e.preventDefault(); // 阻止默认链接行为 targetElement.scrollIntoView({ behavior: "smooth" }); // 平滑滚动到目标元素 }); } else { console.warn( `Either scroll link with ID '${scrollLinkId}' or target element with ID '${targetElementId}' not found.` ); } } // 使用该函数设置多个滚动链接 setupScrollLink("Article_Details_main1L2s_1", "article_main_title1"); setupScrollLink("Article_Details_main1L2s_2", "article_main_title2"); setupScrollLink("Article_Details_main1L2s_3", "article_main_title3"); setupScrollLink("Article_Details_main1L2s_4", "article_main_title4"); setupScrollLink("Article_Details_main1L2s_5", "article_main_title5"); setupScrollLink("Article_Details_main1L2s_6", "article_main_title6"); // 可以继续添加更多的滚动链接设置 }); window.addEventListener("scroll", function () { var fixedElement = document.getElementById("Article_Details_main1Lmain"); var scrollTop = window.scrollY || document.documentElement.scrollTop; // 兼容不同浏览器 var clientHeight = window.innerHeight || document.documentElement.clientHeight; // 视口高度 var scrollHeight = document.documentElement.scrollHeight; // 页面总高度 // 计算距离底部的距离 var distanceToBottom = scrollHeight - scrollTop - clientHeight; // 当距离底部小于或等于300px时,取消固定定位 if (distanceToBottom <= 980) { fixedElement.classList.remove("Article_Details_main1Lmain"); fixedElement.classList.add("Article_Details_main1Lmain_relative"); } else { // 否则,保持固定定位 fixedElement.classList.remove("Article_Details_main1Lmain_relative"); fixedElement.classList.add("Article_Details_main1Lmain"); } }); </script> </body> </html>