首页 > PHP教程

php blog网站开发实例教程(1/8)

  post.php  读文件并显示日志内容的php程序。
  page.html  显示日志文章的html文档。
  style.css教程  页面显示效果的css代码。
  add.php  添加blog文章的php程序。
  config/auth.php 用户名和密码配置文件。
  index.php  blog首页程序。
  edit.php  编辑blog文章的程序。
  delete.php  删除blog文章的程序。
  archives.php 归档显示blog文章的程序。
  logout.php  退出登录的程序。

阅读全文

php获取本机mac地址三种方法

class getmacaddr
{
        var $return_array = array(); // 返回带有mac地址的字串数组
        var $mac_addr;
       
        function getmacaddr($os_type)
        {
                switch ( strtolower($os_type) )
                {
                        case "linux":
                                $this->forlinux();
                                break;
                        case "solaris":
                                break;
                        case "unix":
                                break;
                        case "aix":
                                break;
                        default:
                                $this->forwindows();
                                break;
                }
               
                $temp_array = array();
                foreach ( $this->return_array as $value )
                {
                        if ( preg_match( "/[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f][:-]"."[0-9a-f][0-9a-f]/i", $value, $temp_array ) )
                        {
                                $this->mac_addr = $temp_array[0];
                                break;
                        }
                }
                unset($temp_array);
                return $this->mac_addr;
        }

阅读全文

php 正则表达式替换与正则替换函数

文本有下面标签

<img style src="<?=$url?>/images/styleno.jpg" width="30" height="30" />
<img style src="<?=$url?>/images/styleno.jpg" width="30" height="30" />
<img src="images/styleno.jpg" width="30" height="30" />
<img src="images/styleno.jpg" width="30" height="30" />
想用正则把他们替换成
有 style的 替换成<img src="<?=$url?>/images/styleno.jpg" width="30" height="30" />
没style 的 替换成<img src="<?=$path?>/images/styleno.jpg" width="30" height="30" />

阅读全文