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

php 模板写法


<?php
/* @author: zhuyubing@gmail.com */
class Template{
        var $code;
        function Template($template){
            $this->code = implode('', @file($template));
        }
        function assign($name,$var=null){
    if(is_string($name) && is_string($var)){
     $this->code = str_replace('{'.$name.'}', $var, $this->code);
    } else if(is_array($var)){
     list($this->code,$tmp,$end)=explode('<!--'.$name.'-->',$this->code);
     while(list(,$v)=each($var)){
      $t=$tmp;$k2=$v2='';
      while(list($k2, $v2) = each($v)){
           $t = str_replace('{'.$k2.'}', $v2,$t);
      }
      $this->code .= $t;
     }
     $this->code .= $end;    
    } else {    
     while (list ($k2, $v2) = each($name)){
           $this->code = str_replace('{'.$k2.'}', $v2, $this->code);
     }
    }
        }
        function display(){
                echo $this->code;
        }
}
?>
最简单的hello_world
准备一个php模版文件hello_world.html
<html>
<head>
<meta http-equiv="Content-Type" c />
<title>{title}</title>
</head>
<body>
<h1>{title


相关文档:

php 基础笔记 boolean integer float

/***************************by
garcon1986********************************/
<?php
// boolean integer float example
$action = false;
if($action == "show version"){
echo "the version is 123".'<br>';
}else if($action == false){
echo "action is false".'< ......

PHP上传

/***************************by garcon1986**************************/
form.html
<html>
<head>
<title>Upload File</title>
</head>
<body>
<form enctype="multipart/form-data" method="POST" action="uploader.php">
<label> ......

PHP获取radio值,并用作参数查询数据库,同一页面显示

/***************************by garcon1986************************************/
<?php
error_reporting(E_ALL ^ E_NOTICE);
//create database test
//create table php_radio(id int(10) NOT NULL AUTO_INCREMENT, name varchar(100), description varchar(1000), primary key(id));
//insert php_radio value ......

php中的文件包含


php关键词
      php中用于文件包含的关键词有:include、include_once、require、require_once。一般来说,把include和require分在一组里,而include_once和require_once是一种改进完善形式。本文通过研究include和require的性质,兼顾include_once和require_once,获得php文件包含的基本知识和潜在 ......

《PHP 与 MySQL Web 开发》读书笔记 (一)

概述
1.PHP 是什么?
   PHP 是服务器端解释的脚本语言,它是目前最流行的 web 编程语言之一。  在一个 HTML 页面中可以嵌入PHP代码,这些代码在每次页面访问时执行。PHP 代码将在 Web 服务器中被解释并且生成 HTML或者访问者看到其他输出结果。
2.My SQL 是什么?
   My SQL 是基于 SQL 的完 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号