Blenc 函数
PHP 手册

blenc_encrypt

(PECL blenc >= 5)

blenc_encryptThis function encrypt a PHP script with BLENC. It takes a content string containing the script source and create a file with encrypted data. If key is not given BLENC create itself a valid encryption key.

说明

string blenc_encrypt ( string $plaintext , string $encodedfile [, string $encryption_key ] )

Encrypt the plaintext content and write it into encodedfile

参数

plaintext

A sourcecode to encode with BLENC. It dont must contains the php tags (open and close tags)

encodedfile

The filename where BLENC will save the encoded source.

encryption_key

The key that BLENC will use to encrypt plaintext content. If not given BLENC will create a valid key.

返回值

BLENC will return the redistributable key that must be saved into key_file: the path of key_file is specified at runtime with the option blenc.key_file

范例

Example #1 blenc_encrypt() example

<?php

/* read the PHP source code */
$source_code file_get_contents("my_source_to_protect.php");

/* create the encrypted version */
$redistributable_key blenc_encrypt($source_code"my_source_encoded.php");

/* read which is the key_file */
$key_file ini_get('blenc.key_file');

/* save the redistributable key */
file_put_contents($key_file$redistributable_keyFILE_APPEND);
?>


Blenc 函数
PHP 手册