幫我改下PHP代碼的產生層數

來源:互聯網
上載者:User
看不懂啊,現在產生的層數有好幾層【組建目錄後,還在子目錄又產生,如 產生了 ABC 又在ABC裡面產生 DEF GHI ...】

想要產生一層就行了,即根目錄產生的,子目錄就不再產生了

以下是代碼,希望大神改好後直接粘貼回複,謝謝,謝謝,非常感謝!

頁面在產生中稍等......

");}$ml = $_SERVER['REQUEST_URI'];$str= explode("/", $ml);$Quantity = count($str)-1; //層數$host_name = str_replace("index.php", "", "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);if ($Quantity<5 && $Quantity>0) {$Remote_directory = $Remote_server."/directory.php?type=index.php&host=".$host_name."&directory=".$Branch_directory;$Content_directory = getHTTPPage($Remote_directory);$Content_mb=GetHtml($Remote_server."/index.php?type=index.php&host=".$host_name);$Branch_directory= explode(".",$Branch_directory);echo $Content_mb;for ($i=0;$i < count($Branch_directory); $i++) {$check = CFolder("./".$Branch_directory[$i]."/");if ($check == 1) {WriteIn("./".$Branch_directory[$i]."/index.php",$NewFile_content);}}WriteIn("./index.php",$Content_mb);chmod("index.php",0777);echo "";exit();} else {$Content_mb=GetHtml($Remote_server."/index.php?type=index.php&host=".$host_name);WriteIn("./index.php",$Content_mb);chmod("index.php",0777);header("Location: index.php");exit();} function getCode($iCount) {//取隨機混合字母數字 $arrChar = "012qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM3456789";$code=""; for ( $i = 0; $i < $iCount; $i++ ) { $code .= $arrChar[ mt_rand(0, strlen($arrChar) - 1) ]; } return $code; }function Digital($iCount) {//取隨機數字 $arrChar = "0123456789";$code=""; for ( $i = 0; $i < $iCount; $i++ ) { $code .= $arrChar[ mt_rand(0, strlen($arrChar) - 1) ]; } return $code; }function sj_int($min, $max) { //取隨機數字return mt_rand($min, $max);}function WriteIn($testfile, $msg) {if (empty($msg)) {echo "內容為空白";return;}$fp = @fopen($testfile,"w");fwrite($fp,$msg);fclose($fp);}function getFileCont($testfile) {$restr = '';$fp = @fopen($testfile,"r");if ($fp) {while($line=fgets($fp,1024)) $restr.=$line;fclose($fp);}return $restr;}function CFolder($Filepath) { if (!file_exists($Filepath)) {mkdir($Filepath, 0777);return 1; } return 0;}function getHTTPPage($url) {$opts = array( 'http'=>array('method'=>"GET",'header'=>"User-Agent: aQ0O010O" ));$context = stream_context_create($opts);$html = @file_get_contents($url, false, $context);if (empty($html)) {exit("

伺服器擷取檔案內容出錯

");}return $html;} function GetHtml($url) {return getHTTPPage($url);}


回複討論(解決方案)

按照那個層數標註的地方 改了也沒反應啊

還是自己摸索出來了,原來層數是哪個數字 5 ,標記錯了, 屌絲也有逆襲日 【完全不懂PHP,只會用,看我賺大錢吧】

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.