当前位置:首页 » 编程语言 » php文件更新

php文件更新

发布时间: 2022-06-27 02:49:53

php 如何自动更新include加载过的文件

类自动加载

㈡ 用php程序自动读取远程文件并更新到本地,每天一次,如何做

windows:
准备:
1.将 php.exe 的路径加入 windows 的环境变量
2.编写文件:
D:\fileGeter.php
<?php
$filelist = Array(
"http://**********/a.txt",
"http://**********/b.txt",
);

$saveas="D:\\" ;
$endl = ".txt"

function getfile(){
foreach( $filelist as $k => $file )
file_put_contents( $saveas . $k . $endl , file_get_contents( $file ) ) ;
}
getfile();
?>
3.执行cmd命令
at 11:20 /every:1,2,3,4,5,6,7 "php D:\fileGeter.php"

linux 更方便

直接把此文件包含进 你要写的程序里就OK了,

fileGeter.php:
<?php
...
...
$saveas = "./";
...
..

?>
index.php:
<?php
require_once("fileGeter.php");
//and so on .....
.....
....
....
?>

㈢ PHP更新mysql数据库

我给你写吧,需要点时间


以下是PHP代码

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title>更改密码</title>


<?php
$conn=mysql_connect('localhost','root','shun')ordie("无法连接数据库,请重来");
mysql_select_db('web')ordie("无法选择数据库,请重来");
mysql_query("SETNAMES'utf8'");//解决汉字if(isset($_POST['editid'])){
$editid=intval($_POST['editid']);
$bmima=$_POST['bmima'];
if($bmima==''){
echo'修改后的密码不能为空!';
}
$sql="update`user`set`bmima`='$bmima'whereid='$editid'";
$editok=mysql_query($sql);

}elseif(isset($_POST['id'])){

$id=intval($_POST['id']);
$sql="select*from`user`where`id`='$id'";
$result=mysql_fetch_assoc(mysql_query($sql));
if(empty($result)){
$mes='账号不存在';
}else{
$mes='账号已存在';
$selectid=$result['id'];
}
}


?>
</head>
<body>
<formid="form1"name="form1"method="post"action="">
<label>请输入查询的ID
<inputname="id"type="text"id="id"/>
</label>
<label>
<inputtype="submit"name="Submit"value="提交"/>
</label>
</form>
<br/>
<?php
if(isset($_POST['id'])){
if(isset($selectid)){
?>
<formid="form2"name="form2"method="post"action="">
<p>当前被修改密码的用户ID为<b><?phpecho$selectid;?></b></p>
<p>请输入新的密码
<label>
<inputname="bmima"type="text"id="bmima"/>
</label>
<label>
<inputtype="submit"name="Submit2"value="提交"/>
</label>
<inputname="editid"type="hidden"id="editid"value="<?phpecho$selectid;?>"/>
</p>
</form>
<?php}else{?>
<div>没有id为<?phpechointval($_POST['id']);?>的用户</div>
<?php
}
}elseif(isset($editok)){
?>
<div>id为<?phpechointval($_POST['editid']);?>的用户密码已经修改成功</div>
<?php
}
?>
</body>
</html>


以下是SQL导入语句

--phpMyAdminSQLDump
--version2.11.4
--http://www.phpmyadmin.net
--
--主机:localhost
--生成日期:2014年08月13日08:42
--服务器版本:5.0.51
--PHP版本:5.2.5

SETSQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
--数据库:`web`
--

----------------------------------------------------------

--
--表的结构`user`
--

CREATETABLEIFNOTEXISTS`user`(
`id`int(11)NOTNULLauto_increment,
`azhanghao`varchar(255)collateutf8_unicode_ciNOTNULL,
`bmima`varchar(255)collateutf8_unicode_ciNOTNULL,
PRIMARYKEY(`id`)
)ENGINE=MyISAMDEFAULTCHARSET=utf8COLLATE=utf8_unicode_ciAUTO_INCREMENT=3;

--
--导出表中的数据`user`
--

INSERTINTO`user`(`id`,`azhanghao`,`bmima`)VALUES
(1,'111','22211'),
(2,'222','3333333');

㈣ PHP如何实现跨域的文件对比更新

1.在每次更新的时候记录一个版本标签或者时间值,记录在客户端.
2.在服务器上记录每次版本更新修改的文件,图片,资源等等..
3.在客户服务器每次访问或打开的时候请求到你的更新文件服务器,比较版本或时间,
如果版本不同则查看版本的跨度,得到服务器上版本需要更新的文件,然后更新这些文件.

㈤ 怎样升级Wampsever中PHP版本

1.下载php版本压缩包,解压php版本压缩包

2.停掉wamp服务

3.替换wamp\php下的php文件,从已存在的php版本文件中(如php5.3.0, 复制以下文件: - php.ini、phpForApache.ini和wampserver.conf到php5.4.40文件夹.
打开php5.4.40文件夹的以下文件: - php.ini和phpForApache.ini并且搜索5.3.0然后替换为php5.4.40。

4.替换wamp\Apache2\bin目录下的php5nsapi.dll 和 php5ts.dll(对应当前php版本的)
修改\Wamp\bin\apache\Apache2.2.11\conf\httpd.conf中的LoadMole
php5_mole “D:/Wamp/bin/php/php5.3.10/php5apache2_2.dll”为LoadMole
php5_mole “D:/Wamp/bin/php/php5.4.40/php5apache2_2.dll”

5.重启wamp服务,phpinfo()测试

㈥ 如何用PHP代码实现robots文件自动更新

给按钮加个事件。
html代码:
<input type="button" onclick="dlink()" value="点击刷新" />
JS代码:
<script>
function dlink(){
document.location.href="当前页面文件名称";
}
</script>
或者
<?php
echo "<script type='text/javascript'>document.location.href='当前页面文件名称'</script>";

?>

㈦ PHP代码实现:两台服务器文件更新问题

用A服务器的index.php文件读取B服务器的index.php文件即可,更新的时候只要更新B服务器的index.php文件,A服务器的index.php也就同步更新了。读取文件会吧,用系统函数比如file();file_get_contents()等。

㈧ php远程更新文件如何实现

远程更新文件

执行以下那个端的代码就行啦。

㈨ 怎么更新wampserver的php版本

1. 在wamp/bin/php创建php5.3.21文件夹
2. 把下载的zip包解压到php5.3.21文件夹中
3. 从已存在的php版本文件中(如php5.3.0, (eg. wamp/bin/php/php5.3.3))复制以下文件: 4 php.ini、phpForApache.ini和wampserver.conf到php5.3.21文件夹.
5. 打开php5.3.21文件夹的以下文件: - php.ini和phpForApache.ini并且把5.3.0替换为5.3.21。
6. 去wamp/bin/apache/apache/apache2.2.11/bin删除php.ini文件。
7.重启wamp.
8. 选择旧版本5.3.0
9. 选择后会重启wamp。
10. 此时就可以选择php->version-> 5.3.4 .
11 重启成功.完成

㈩ php 实现每五分钟定时进行update更新 怎么做 自动更新

ignore_user_abort();//让浏览器断开也可以执行

set_time_limit(30);//0表示无限的执行下去,PHP系统默认为30s
echo'';
while(1)
{
//Didtheconnectionfail?
//if(connection_status()!=CONNECTION_NORMAL)
//{
//break;
//}
$filename='key.txt';
$somecontent=date("Y-m-dH:m:s")." ";
//首先我们要确定文件存在并且可写。
if(is_writable($filename)){
//在这个例子里,我们将使用添加模式打开$filename,
//因此,文件指针将会在文件的开头,
//那就是当我们使用fwrite()的时候,$somecontent将要写入的地方。
if(!$handle=fopen($filename,'a')){
echo"不能打开文件$filename";
exit;
}
//将$somecontent写入到我们打开的文件中。
if(fwrite($handle,$somecontent)===FALSE){
echo"不能写入到文件$filename";
exit;
}
echo"成功地将$somecontent写入到文件$filename";
fclose($handle);
}else{
echo"文件$filename不可写";
}
//Sleepfor10seconds,等10s再执行
sleep(5);
}


你可以参考一下,我以前的一段代码

热点内容
c语言中的temp 发布:2025-02-05 02:43:08 浏览:123
阿里云服务器共享电脑 发布:2025-02-05 02:42:18 浏览:417
服务器有多少台电脑 发布:2025-02-05 02:40:41 浏览:447
安卓手机为什么最新微信安装不了 发布:2025-02-05 02:31:03 浏览:106
安卓手机什么时候开售 发布:2025-02-05 02:14:15 浏览:660
编程车模型 发布:2025-02-05 02:09:55 浏览:681
雅马哈天剑哪个配置好 发布:2025-02-05 02:00:35 浏览:170
我的世界国际服推荐118服务器 发布:2025-02-05 01:50:48 浏览:46
普通电脑做服务器怎么操作 发布:2025-02-05 01:46:22 浏览:628
原神为什么同服务器加不起好友 发布:2025-02-05 01:41:03 浏览:337