本文整理汇总了PHP中Env::encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Env::encrypt方法的具体用法?PHP Env::encrypt怎么用?PHP Env::encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Env
的用法示例。
在下文中一共展示了Env::encrypt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Env
<?php
/**
* Created by PhpStorm.
* User: andrij
* Date: 10.07.15
* Time: 9:35
*/
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
require_once 'env.class.php';
$env = new Env();
define("ENCRYPTION_KEY", "!@#\$%^&*");
$selectQuery = $env->decrypt($_POST['data'], ENCRYPTION_KEY);
$result = $env->selectQuery($selectQuery);
foreach ($result as $resultEl) {
echo $resultEl = $env->encrypt($resultEl, ENCRYPTION_KEY);
echo $env->encrypt('<br>', ENCRYPTION_KEY);
}
示例2: Env
<select name="action">
<option>query</option>
</select><br/><br/>
<input type="text" name="query" placeholder="query" value="SELECT * FROM blog.articles;" style="width: 15%"><br/><br/>
<button id="encrypt" type="submit">Send</button>
</form>
</body>
</html>
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
define("ENCRYPTION_KEY", "!@#\$%^&*");
require_once 'env.class.php';
$env = new Env();
$action = $env->encrypt($_POST['action'], ENCRYPTION_KEY);
$data = $env->encrypt($_POST['query'], ENCRYPTION_KEY);
echo 'Encrypted action - ' . $action . '<br><br>';
echo 'Encrypted query - ' . $data . '<br><br>';
echo '<hr>';
echo 'Encrypted response :' . '<br><br>';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://localhost/tasks/router.php');
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, "data={$data}&action={$action}");
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U;Windows NT 5.1; ru; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9');
$exec = curl_exec($ch);
curl_close($ch);