首页 > 编程技术 > php

PHP静态类

发布时间:2016-11-25 16:10

<?php
class Shtml
  {
    var $Templet;
    var $DataSource;
    var $Dir;
 
    var $fileName;
    var $mod;
    var $handle;
 
    function Shtml($fileName="")
    {
      $this->fileName=$fileName;
      $this->mod="wb";
      $this->handle=false;
 
      $this->Templet    = "";
      $this->DataSource  = array();
      $this->Dir      = "";
    }
   
    ///  <描述>
    ///  绑定数据源,参数为一数组。
    ///  </描述>
    function BindData($arr)
    {
      $this->DataSource = $arr;
    }
   
    ///  <描述>
    ///  设置文件存放路径。
    ///  </描述>
    function SetDir($dir)
    {
      $this->Dir = $dir;
    }
    function SetFileName($fileName)
    {
      return $this->fileName=$fileName;
    }
 
    function GetMod()
    {
      return $this->mod;
    }
    function SetMod($mod)
    {
      return $this->mod=$mod;
    }
    function Open()
    {
      if(substr($this->fileName,0,1)=="/")
        $this->fileName = $_SERVER[''DOCUMENT_ROOT''] . $this->fileName;
  今天继续提交读程序笔记,这次比较少,而且相对简单些。

ConnectorComputation
    - compute()
        如果workList还有元素,就继续循环,但是第一次进入循环时候根据构造方法来看workList只有一个元素<mainFunction, emptyCallString>。然后从workList中取出第一个元素,获取TacFunction和CallString(gamma),根据TacFunction(p)从function2ECS中得到ECS(ecs_p),实际上此时functions2ECS中第一个元素对应的TacFunction即为_main。得到gamma在ecs_p中的位置,即是在一个CallString的链表中的位置
        随后,将p这个TacFunction包含的所有的CfgNodeCall迭代一遍,对于每一个callNode,得到其callee(即被调用的函数q),在q!=null的情况下,以callNode建立一个新的CallString(gamma_2),从function2ECS中得到q对应的ECS(ecs_q),获取ecs_q中gamma_2的位置,如果为-1,就将gamma_2添加到ecs_q的CallStrings队列中去,并以q和gamma_2建立元素添加到workList中去,expand it。
        接下来扩充什么ConnectorFunction因为都在for循环里边,是对局部变量的操作,所以没有什么用处。
        在while循环结束之后,调用makeCallGraph()方法。
    - makeCallGraph()
        首先以mainFunction初始化一个CallGraph,获得mainFunction所包含的方法调用列表processUs<CfgNodeCall>,并建立一个以访问的集合visited,将mainFunction添加进集合里边。
        当processUs不为空,依次取出元素callNode,得到它的caller和callee,如果callee!=null,向callGraph中添加元素。如果callee还没有被处理过,则将其所包含的所有函数调用添加进processUs,并将其放进visited。


Checker
    根据初始提供的run-all.bat的参数来看,实际上aliases analyze和literal analyze并没有进行,只是gta.analyze()进行了,实际上也就是只有dependance analyze执行了。通过以来关系最后决定vulns。

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。http://blog.111cn.net/mayongzhan - 马永占,myz,mayongzhan

php扩展分为两种.一种是php的扩展,一种是zend扩展.(传说中的,这是programing php里讲的).真的希望能有人发表一些关于zend扩展的东西.这才是真正的核心.
本来是要读下源码的.但是似乎php的源码很多.目前只能扫扫边边角角.如果有机会的话,会去读一下源码的.
其实扩展并不是很难,php已经给好了例子和扩展的工具.使用一下就可以了.
先下php源码,解压
然后到解压目录,ext下 执行./ext_stel --extname=myz
然后到解压目录,执行
./buildconf --force
./configure --with-myz=shared --其他的
make
make install

然后就能看到phpinfo()里面多了个myz了.

这里编译了好几次.好象每次都有新问题.多调试几次一定会成功的."妻儿"不舍

附:php源码包中两个重要的文件内容
README.EXT_SKEL
README.SELF-CONTAINED-EXTENSIONS

README.EXT_SKEL

(NOTE: you may also want to take a look at the pear package
      PECL_Gen, a PHP-only alternative for this script that
    supports way more extension writing tasks and is
    supposed to replace ext_skel completely in the long run ...)

WHAT IT IS

  It''s a tool for automatically creating the basic framework for a PHP module
  and writing C code handling arguments passed to your functions from a simple
  configuration file. See an example at the end of this file.

HOW TO USE IT

  Very simple. First, change to the ext/ directory of the PHP 4 sources. If
  you just need the basic framework and will be writing all the code in your
  functions yourself, you can now do

   ./ext_skel --extname=module_name

  and everything you need is placed in directory module_name.

  [ Note that GNU awk is likely required for this script to work.  Debian
    systems seem to default to using mawk, so you may need to change the
    #! line in skeleton/create_stubs and the cat $proto | awk line in
    ext_skel to use gawk explicitly. ]

  If you don''t need to test the existence of any external header files,
  libraries or functions in them, the module is already almost ready to be
  compiled in PH

<

本文件可以用于自动创建目录下所有JPG图片的缩略图,放到图片目录下运行即可。
缺点:长宽不一的图片会被拉伸变形,不能智能裁切,需要智能裁切的,请自行研究。



<?php
$config = array();
$config[''path''] = "./";
$config[''t_width''] = 120;
$config[''t_height''] = 98;
$config[''ignore''] = array("",".",

<
标签:[!--infotagslink--]