易截截图软件、单文件、免安装、纯绿色、仅160KB

PHP简单计数器

 <?php
/*使用文本文件记录数据的简单实现*/
$counter=1;
if(file_exists("mycounter.txt")){
$fp=fopen("mycounter.txt","r");
$counter=fgets($fp,9);
$counter++;
fclose($fp);
}
$fp=fopen("mycounter.txt","w");
fputs($fp,$counter);
fclose($fp);
echo "<h1>您是第".$counter."次访问本页面!<h1>";
?>
<?php
//下面这个为使用基于数据库的简单计数器,未添加其他防止一人重复刷新的方法。仅供参考。。
$conn=mysql_connect("localhost","root","abc");
$result=mysql_query("use db_counter");
$re=mysql_query("select * from tb_counter");
$result=mysql_fetch_row($re);
$counter=$result[0];
echo "您是第{$counter}位访问者!";
$counter+=1;echo "<hr>{$counter}";
mysql_query("update tb_counter set counter=$counter");
mysql_close($conn);
?>


相关文档:

php字符串函数

 
1查找字符位置函数:
strpos($str,search,[int]):查找search在$str中的第一次位置从int开始;
stripos($str,search,[int]):函数返回字符串在另一个字符串中第一次出现的位置。该函数对大小写不敏感
strrpos($str,search,[int]):查找search在$str中的最后一次出现的位置从int
2、提取子字符函数(双字节)
subm ......

详细解释PHP中header和content


void header ( string string [, bool replace [, int http_response_code]] )
void header ( string string [, bool replace [, int http_response_code]] )
header()是用来发送 HTTP Header的。replace是个可选的参数,指示是否替代一个先期相似的header,
......

从今天开始,好好学习PHP~~

  今天是一个值得纪念的日子,终于把别的事情都干掉了,可以一心一意的学习我最爱的PHP了,小欢呼一下.耶~~
  首先.结合自己的思考,有了几个关于1+1=2的表示方法,具体罗列如下:
首先是一种很简单的表示方法:
<?php
  $a =1+1;
  echo "1+1=".$a;
?>
//这种方法用的并不多,只是为了加深对变量 ......

linux下快速安装apache+php+mysql

 (1)、yum安装mysql
//yum安装
yum -y install mysql mysql_server
//在服务清单中添加mysql服务
chkconfig --add mysqld
//服务启动
service mysqld start
//初始化mysql数据库
/usr/bin/mysql_secure_installation
(2)、安装apache
yum -y install httpd
service httpd start
添加iptables允许访 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号