php教程|PHP源码
nbsp,title,dir,content,quot
php教程-PHP源码
php 读取文件内容并保存到数据库
ec(2);本程序的功能是读取目录下的txt 文件,然后保存到数据哦,就这么简单,下面我们就来看看我是如何把txt文件内容保存到mysql数据表的吧。
dnf一键卡任务源码,node vscode首选配置,ubuntu 的仓库,tomcat 8稳定吗,爬虫清水数据,php解析xml文件,seo快排哪家好推广,网站qq在线咨询悬浮怎么设置,表单注册登录带验证模板lzw
<?php
include(‘../boke/inc/re_conn.php’);
大气橙色网络公司织梦源码,VScode中ros插件,ubuntu显卡工作,tomcat nfs读取,安卓下的sqlite文件,做黑客要学爬虫吗知乎,销售管理系统 php,大丰区seo优化辅助,信息分类网站 功能,电商模板 html源码下载lzw
CheckDir(‘file/’);
易语言投票源码,vscode 更换背景,ubuntu 子系统的缺点,tomcat 冷部署,sqlite事务隔离级别,流程图绘制插件,岚图free 前端框架,路飞爬虫课程视频,php 排名%比,首页seo标题,货源网网站源码,网页 在线聊天,源码营ppt模板,html页面输出时间,管理系统模板代码下载,团购的程序lzw
function CheckDir($dir_path)//遍历目录
{
if(is_dir($dir_path))
{
if($dir_file=opendir($dir_path))
{
while(($dir_list=readdir($dir_file))!==false)
{
if($dir_list!=”.” && $dir_list!=”..”)
{
$title =substr($dir_list,6,strlen($dir_list)-4);
//echo $title;
openFile($dir_path.$dir_list,$title);
}
}
}
else
{
echo($dir_path.”
“);
}
}
else
{
echo($dir_path.”
“);
}
}
function savaDate($title,$content)//保存数据
{
$title = str_replace(‘.txt’,”,$title);
echo $title;
$content = addslashes($content);
$sql =”insert into fil(title,content,siteindex,filesendid,systype,z_type) values(‘$title’,’$content’,1,’admin’,2,31)”;
if( mysql_query( $sql ) )
{
echo ‘success
‘;
}
else
{
echo mysql_error();
}
}
function openFile($filePath,$title)//读取文件内容提要
{
if( is_file( $filePath ) )
{
$content = file_get_contents( $filePath );
if( !empty( $content ) )
{
savaDate($title,$content);
}
else
{
;
}
}
}
?>
本站原创转载注明: