用php 代码上传一个txt文件,在页面里面输出内容
用php代码上传一个txt文件,在页面里面输出内容上传一个txt文件包含如下信息*tensionThere'sanindefinableairoftensionatthe...
用php 代码上传一个txt文件,在页面里面输出内容
上传一个txt文件包含如下信息
* tension
There's an indefinable air of tension at the meeting.
The tension in the Far East is building up again.
* reputation
She had a reputation for punctuality.
This restaurant has a fine reputation.
页面输出
tension$There's an indefinable air of tension at the meeting.
reputation$She had a reputation for punctuality.
PS。思路应该是先用“*”分割内容。然后在采集第一行的单词,及此单词下的第一句句子。 展开
上传一个txt文件包含如下信息
* tension
There's an indefinable air of tension at the meeting.
The tension in the Far East is building up again.
* reputation
She had a reputation for punctuality.
This restaurant has a fine reputation.
页面输出
tension$There's an indefinable air of tension at the meeting.
reputation$She had a reputation for punctuality.
PS。思路应该是先用“*”分割内容。然后在采集第一行的单词,及此单词下的第一句句子。 展开
展开全部
<?php
if (@is_uploaded_file($_FILES['upfile']['tmp_name'])){
$f = $_FILES["upfile"];
$name = $f['name'];
$type = $f['type'];
$error = $f['error'];
$tmp = $f['tmp_name'];
$size = $f['size'];
if($error==0){
move_uploaded_file($tmp,"./$name");
echo '上传成功!<br />';
$Read_file = Read_it($name);
foreach($Read_file as $v){
$a = explode("\n",$v);
echo $a[0]."$".@$a[1]."<br />";
}
}
}
//read file
function Read_it($files){
if (file_exists($files)){
$file = file_get_contents($files);
$file = explode("*",trim($file));
return $file;
} else {
echo "The file named ".$filename."can not find.";
}
}
//read end
?>
<form enctype="multipart/form-data" method="post" name="up" action="">
<input name="upfile" type="file"/>
<input type='submit' />
</form>
效果实现了,具体你自己修改下
追问
其实*号分割我是会的,我就是不知道后面的该怎么写。
追答
难道我回答的不对吗?从上传,到你所说的显示的方式,都实现了已经。
2015-07-16 · 知道合伙人软件行家
emeipanda
知道合伙人软件行家
向TA提问 私信TA
知道合伙人软件行家
采纳数:329
获赞数:1494
曾获联想、华为、Juniper认证,现任职于四川省内江市GPS卫星监控中心总工程师,主持技术管理工作逾10年。
向TA提问 私信TA
关注
展开全部
用php 代码上传一个txt文件,在页面里面输出内容
上传一个txt文件包含如下信息
* tension
There's an indefinable air of tension at the meeting.
The tension in the Far East is building up again.
* reputation
She had a reputation for punctuality.
This restaurant has a fine reputation.
页面输出
tension$There's an indefinable air of tension at the meeting.
reputation$She had a reputation for punctuality.
PS。思路应该是先用“*”分割内容。然后在采集第一行的单词,及此单词下的第一句句子。
上传一个txt文件包含如下信息
* tension
There's an indefinable air of tension at the meeting.
The tension in the Far East is building up again.
* reputation
She had a reputation for punctuality.
This restaurant has a fine reputation.
页面输出
tension$There's an indefinable air of tension at the meeting.
reputation$She had a reputation for punctuality.
PS。思路应该是先用“*”分割内容。然后在采集第一行的单词,及此单词下的第一句句子。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-12
展开全部
淘宝API怎么链接啊?php的SDK怎么连接并调取测试呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询