php實(shí)現(xiàn)curl模擬ftp上傳的方法
本文實(shí)例講述了php實(shí)現(xiàn)curl模擬ftp上傳的方法。分享給大家供大家參考。具體如下:
<?php function upload($dir,$src,$dest) { $ch = curl_init(); $fp = fopen($src, 'r'); curl_setopt($ch, CURLOPT_URL, 'ftp://user:pwd@host/interpretation/'.$dir .'/'. $dest); curl_setopt($ch, CURLOPT_UPLOAD, 1); curl_setopt($ch, CURLOPT_INFILE, $fp); curl_setopt($ch, CURLOPT_INFILESIZE, filesize($src)); curl_exec ($ch); $error_no = curl_errno($ch); curl_close ($ch); if ($error_no != 0) { return 0; }else{ return 1; } } upload("images","s.py","aaa.py"); ?>
希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。
相關(guān)文章
PHP 雜談《重構(gòu)-改善既有代碼的設(shè)計(jì)》之三 重新組織數(shù)據(jù)
承接上文的PHP 雜談《重構(gòu)-改善既有代碼的設(shè)計(jì)》之 重新組織你的函數(shù)繼續(xù)重構(gòu)方面的內(nèi)容2012-04-04php8擴(kuò)展arginfo生成工具及工具初體驗(yàn)介紹
這篇文章主要為大家介紹了php8的擴(kuò)展arginfo生成工具及工具初體驗(yàn),有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-06-06

PHP圖片處理之使用imagecopyresampled函數(shù)實(shí)現(xiàn)圖片縮放例子

PHP使用Http Post請(qǐng)求發(fā)送Json對(duì)象數(shù)據(jù)代碼解析

ADODB結(jié)合SMARTY使用~超級(jí)強(qiáng)