输入挂,原理是把文件里面的东西用fread一次性读到内存。
使用时必须 #include “cctype”, 先调用 IO:init(); 然后全部用 IO:readint() 读入数据;namespace IO {
const static int maxn = 200 << 20;
static char buf[maxn], *pbuf = buf, *End;...
分类:
其他好文 时间:
2015-08-17 21:54:17
阅读次数:
143
<?php $fp=fopen(‘ffff.txt‘,‘r‘); $str=fread($fp,filesize("ffff.txt")); fclose($fp); echo "替换前:\n".$str; $str=preg_replace(‘/^\s*$/m‘, ‘‘, $str); $str=preg_replace(‘/\n{2}/‘, "\n", $str); echo "替...
分类:
Web程序 时间:
2015-08-17 12:20:48
阅读次数:
244
现有保存在服务端的文件orders.txt,内容为:
现创建vieworder.php文件,将其读出并显示;
客户订单
我们的商店
客户订单
<?php
//打开文件,(只读模式+二进制模式)
@$fp=fopen("$DOCUMENT...
分类:
Web程序 时间:
2015-08-17 12:01:30
阅读次数:
122
1.打开/关闭文件 ? ? 首先来看一下Python中的open函数: ? ? open(file, mode=‘r‘, buffering=-1, encoding=None) ? ? 1)file: 文件名 ? ? 2)mode: 这个跟标准c库中fopen中的mode参数取值类似: ...
分类:
编程语言 时间:
2015-08-17 01:16:07
阅读次数:
173
bool checkOnly(){ const char filename[] = "./lockfile"; int fd = open (filename, O_WRONLY | O_CREAT , 0644); int flock = lockf(fd, F_TLOCK, ...
分类:
编程语言 时间:
2015-08-16 17:56:37
阅读次数:
258
prepare($sql); $st->bindParam(':title', $title); $st->bindParam(':tid', $tid); $st->bindParam(':mid', $mid); $st->bindParam(':uname', $una...
分类:
其他好文 时间:
2015-08-15 10:20:04
阅读次数:
154
文件锁的玩法
1、普通两个文件同时往一个文件中写入内容效果
index-1.php
$file = 'temp.txt';
$fp = fopen($file,'a');
for($i = 0;$i
{
fwrite($fp, "11111111");
sleep(1);
}
fclose($fp);
?>
index-2.php...
分类:
其他好文 时间:
2015-08-13 15:48:01
阅读次数:
106
学完了记得动手操作。
欢迎来到我的留言板!
name:
email:
content:
<?php
header("Content-type: text/html; charset=utf-8");
$con = mysql_connect("qdm113416583.my3w.com","qdm113416583","123456789");
if (!$con)...
分类:
数据库 时间:
2015-08-13 06:32:32
阅读次数:
152
首先由一个文本文档read.txtliulan.html 留言 标题: 留言: 1.php","查看资源","";?>2.php",$row[0],"","\n"; $i=$i+1;}fclose($fo);?>3.php
分类:
Web程序 时间:
2015-08-12 23:00:35
阅读次数:
111
1,在可以用file_get_contents替代file,fopen,feof,fget等系列方法的情况下,尽量使用feil_get_contents,因为它的效率高得多!但是要注意file_get_contents在打开url文件时的php版本问题 2,尽量的少进行文件操作...
分类:
Web程序 时间:
2015-08-12 20:00:56
阅读次数:
168