ZendGuard下载
下载之前需要注册,我下的版本是Zend Guard 6.0。双击运行即可傻瓜式安装。

最新的版本是7.0,如果想下载早期的版本,请点击:>Download here,当前页面下方会弹出早期版本的列表。
PHP下载
php一个版本一般会发布两种类型的程序,一种是线程安全的(Thread Safe),另一种是非线程安全的(Non Thread Safe)。
值得注意的是:ZendGuard只支持非线程安全的。所以请选择非线程安全的PHP下载。
配置PHP——ZendLoader.dll
1. 下载ZendLoader.dll
官方下载地址:
下载之前请注册,与ZendGuard下载类型,注意选择对应PHP版本的ZendLoader。

将ZendLoader.dll拷贝到PHP
[PHP的根目录]\ext\中。 2. 修改php.ini-development或者php.ini-production为php.ini, 在php.ini文件中添加以下内容:
zend_extension="./ext/ZendLoader.dll"
; Enables loading encoded scripts. The default value is On
zend_loader.enable=1
; Disable license checks (for performance reasons)
zend_loader.disable_licensing=0
; The Obfuscation level supported by Zend Guard Loader. The levels are detailed in the official Zend Guard Documentation. 0 - no obfuscation is enabled
zend_loader.obfuscation_level_support=3
; Path to where licensed Zend products should look for the product license. For more information on how to create a license file, see the Zend Guard User Guide
zend_loader.license_path=
新建PHP代码 新建input文件夹,在input文件夹中新建test.php。
代码如下:
date_default_timezone_set("Asia/shanghai");
echo "Thanks ZendGuard!\n";
echo "Now datetime is ".date("Y-m-d h:i:s")."\n";
?>
上述代码输出:
Thanks ZendGuard
Now datetime is 当前时间.
ZendGuard安装及新建项目
ZendGuard是傻瓜式安装,安装之后,运行起来,效果如下。

1. 新建Zend Guard Project工程。
2. 指定输出文件为output文件夹。

3. 添加输入文件夹为input文件夹。
4. 选择PHP版本

5. 点击
6. output文件夹中新生成了test.php,打开看是乱码。
运行源代码及加密代码
运行源代码效果:

运行加密代码效果:

至此,就可以用ZendGuard就可以对PHP代码进行加密。