Skip to content

Latest commit

 

History

History
18 lines (17 loc) · 752 Bytes

README.md

File metadata and controls

18 lines (17 loc) · 752 Bytes

CreateDiffPic

实现方法:生成两个文件的对比网页,然后用PhantomJS将网页生成图片。详情请见example.php:

  <?php
    define("SITE_PATH", dirname(__FILE__));
    $old_path = SITE_PATH."/log/old";
    $new_path = SITE_PATH."/log/new";
    $js_path = SITE_PATH."/diff/deal.js";
    $request_url = "http://10.16.15.225/diff/index.php"; //根据自己的网络设置,即访问diff目录下的index.php文件
    $img_path = SITE_PATH."/log/diff.png";
    $command = "/usr/bin/phantomjs {$js_path} {$request_url} {$img_path}";
    shell_exec($command);
  ?>

生成图片效果: image

PhantomJS: http://phantomjs.org