Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[分享] 我自己用PHP 开发了一个中秋许愿程序

[复制链接]
benba 发表于 2009-6-9 20:06:21 | 显示全部楼层 |阅读模式
本帖最后由 benba 于 2009-6-11 00:05 编辑

这几天闲着练习一下PHP技术.自己用PHP开发了一个中秋节许愿的程序.用的文本存储,没有用MYSQL的哦.安装和删除很方便. 这几天写完了测试好了BUG发上来供大家研究学习哈!((mk05))

已发布出来呢: https://discuz.dismall.com/thread-1322787-1-1.html
回复

使用道具 举报

 楼主| benba 发表于 2009-6-9 20:07:57 | 显示全部楼层
1# benba
未命名.jpg
还没有去美化...后面来!!!
回复

使用道具 举报

yushine 发表于 2009-6-9 20:53:59 | 显示全部楼层
和留言本没区别
文本存储够用了
不需要数据库
回复

使用道具 举报

chizhuy 发表于 2009-6-9 20:54:20 | 显示全部楼层
沙发先做起多!此贴必活!~
回复

使用道具 举报

yushine 发表于 2009-6-9 21:12:50 | 显示全部楼层
沙发先做起多!此贴必活!~
chizhuy 发表于 2009-6-9 20:54


都藤椅了。。还沙发呢?
这帖子肯定不会死
呵呵
回复

使用道具 举报

 楼主| benba 发表于 2009-6-9 21:38:17 | 显示全部楼层
最原始的源代码!!!发帖子前面几分钟写的......

  1. <?php

  2. ob_start();
  3. if (@phpversion() > '5.1.0'){//大于5.1.0
  4. date_default_timezone_set('Asia/Chongqing'); //设置时区
  5. }
  6. $datefile="data";  //数据存在哪个文件里好呢?你来设置吧!
  7. $x=1;
  8. $name='小郭';
  9. $qq='75142913';
  10. $where='重庆';
  11. $email='benba@qq.com';
  12. $content='祝广大网友们中秋快乐,万事如意,心想事成,祝郭子发大财,赚更多的钱!祝广大网友们中秋快乐,万事如意,心想     事成.初郭子发大财,赚更多的钱!







  13. ';
  14. $str = trim($content);
  15. $str = preg_replace('/\s(?=\s)/', '', $str);
  16. $content = preg_replace('/[\n\r\t]/', ' ', $str);

  17. $showtime=time();
  18. $ip = getenv("REMOTE_ADDR");

  19. $arr=array(
  20. "name"=>"$name",
  21. "qq"=>"$qq",
  22. "where"=>"$where",
  23. "email"=>"$email",
  24. "content"=>"$content",
  25. "showtime"=>"$showtime",
  26. "ip"=>"$ip");
  27. if ($x)
  28. {
  29.                 $arr=serialize($arr);
  30.                 $content=$arr."\n";
  31.                
  32.                 $fp=@fopen($datefile,'a');  
  33.                
  34.                 if (@fwrite($fp,$content))
  35.                 {
  36.                         @fclose ($fp);
  37.                 }
  38.                 else
  39.                 {
  40.                         @fclose ($fp);
  41.                         die ("写入{$datefile}失败!");
  42.                 }
  43. }

  44.         $fp=@fopen($datefile,'r');
  45.        
  46.                 while(!feof($fp))
  47.                 {
  48.                         $buffer=fgets($fp,40960);
  49.                         $data=unserialize($buffer);
  50.                        
  51.                         $showdate=date("Y-m-d h:m:s", $data[showtime]);
  52.                        
  53.                         if ($data)
  54.                         {
  55.                                 echo "
  56.                                 <div>
  57.                                 <h2>来自:{$data[where]}的{$data[name]} 在{$showdate}说:</h2>
  58.                                 <p>
  59.                                 {$data[content]}
  60.                                 </p>
  61.                                 <span>邮箱:{$data[email]} IP地址:{$data[ip]}  QQ:{$data[qq]} </span>
  62.                                 </div>";
  63.                         }
  64.                 }
  65. ?>
复制代码
回复

使用道具 举报

228591898 发表于 2009-6-9 22:18:50 | 显示全部楼层
回复

使用道具 举报

a624762500 发表于 2009-6-9 23:19:35 | 显示全部楼层
这个好用,我安装上了
回复

使用道具 举报

jiantian 发表于 2009-6-9 23:51:59 | 显示全部楼层
呵呵 搬个凳子 占座.....
回复

使用道具 举报

zdemo 发表于 2009-6-10 08:03:49 | 显示全部楼层
支持老大((em:08))
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-14 08:43 , Processed in 0.114236 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表