<?php
error_reporting(0);
// $str=‘D:\admin\z1\addons\ewei_shopv2\template\mobile\default\member\address‘;
$aa1=file_get_contents(‘test1.txt‘);
if(!empty($_POST[‘cont‘])){
$p=$_POST[‘cont‘];
$str1=str_replace(" ", ",", $p);
if(strpos($str1,‘,‘)){
$arr=explode(‘,‘, $str1);
foreach($arr as $k=>&$v){
$v=‘/‘.str_replace(‘\\‘, ‘/‘, $v);
}
$arr2=array();
foreach ($arr as $key => $value) {
$temp=explode(‘/‘, $value);
array_pop($temp);
$temp=implode(‘/‘, $temp);
$arr2[]=$temp;
}
}else{
$str1=‘/‘.str_replace(‘\\‘, ‘/‘, $str1);
$temp=explode(‘/‘, $str1);
array_pop($temp);
$temp=implode(‘/‘, $temp);
$arr2[]=$temp;
}
// var_dump($arr2);die;
// $str1=str_replace("\\", "/", $_POST[‘cont‘]);
// $str1=str_replace("D:/admin/z1", "", $str1);
// $aa=‘/addons/ewei_shopv2/plugin/app/core/mobile/member‘."\n";
foreach ($arr2 as $key => $value) {
file_put_contents(‘test1.txt‘, $value."\n",FILE_APPEND);
}
// file_put_contents(‘test1.txt‘, $arr2."\n",FILE_APPEND);
$aa1=file_get_contents(‘test1.txt‘);
// echo $str1;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Hello, World</title>
<style type="text/css">
html{height:100%}
body{height:100%;margin:0px;padding:0px}
#container{height:100%}
</style>
</head>
<body>
<div style="width:900px; height=1000px; margin:40px auto;">
<?php if(is_array($arr2)){?>
<div>
<?php foreach ($arr2 as $key => $value) {?>
<input type=‘text‘ value="<?php echo $value?>" style="width:500px"><br>
<?php }?>
</div>
<?php }?>
<form action="" method="post">
<input type="text" name="cont" style="width:400px"/><input type="submit" value="提交">
</form>
<textarea cols=100 rows=100><?php echo $aa1; ?></textarea>
</div>
</body>
</html>