本文整理汇总了PHP中Crypt::setKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypt::setKey方法的具体用法?PHP Crypt::setKey怎么用?PHP Crypt::setKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crypt
的用法示例。
在下文中一共展示了Crypt::setKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetKey
/**
* Tests Crypt->setKey()
*/
public function testSetKey()
{
// Set new key
$newkey = 'gjhfdbhTGFJUGFDbvfdJHGFNcxfdsgDHVCNBfdsgjhgfNfdhgfdhd';
$this->crypt->setKey($newkey);
// Reset to old key
$this->crypt->setKey(self::KEY);
unset($newkey);
}
示例2: __construct
/**
* constructor function
*
* @param string $obfuscatedFilePostfix
*/
public function __construct($key = '', $obfuscatedFilePostfix = "")
{
$this->level = '';
$this->key = $key;
if (trim($obfuscatedFilePostfix) != "") {
$this->obfuscatedFilePostfix = $obfuscatedFilePostfix;
}
Crypt::setKey($this->key);
}
示例3: captcha
/**
* 输出验证码
*/
public function captcha()
{
$builder = new CaptchaBuilder();
$builder->build();
$phrase = $builder->getPhrase();
Crypt::setKey(Config::get('app.cookie_key'));
$phrase_new = Crypt::encrypt($phrase);
Session::flash('__captcha', $phrase_new);
header("Cache-Control: no-cache, must-revalidate");
header('Content-Type: image/jpeg');
$builder->output();
exit;
}
示例4: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('demographics', function (Blueprint $table) {
$table->string('creditcard_key', 255)->nullable()->default('');
});
$query = DB::table('demographics')->where(function ($query_array1) {
$query_array1->where('creditcard_number', '!=', '')->orWhereNotNull('creditcard_number');
})->get();
if ($query) {
foreach ($query as $row) {
$key = MD5(microtime());
Crypt::setKey($key);
$new = Crypt::encrypt($row->creditcard_number);
$data = array('creditcard_key' => $key, 'creditcard_number' => $new);
DB::table('demographics')->where('pid', '=', $row->pid)->update($data);
}
}
}
开发者ID:carlosqueiroz,项目名称:nosh-core,代码行数:23,代码来源:2015_04_14_202233_add_creditcard_key_to_demographics_table.php
示例5: Crypt
<?php
require_once '../Crypt.php';
$crypt = new Crypt();
$crypt->setKey('YOUR CYPHER KEY');
$crypt->setComplexTypes(TRUE);
$crypt->setData('cryptPHP#bWOXEusBnyDHRuNY+zAyqOWpYLPkmSMJ#tdcvQqIxylC3bNuxFQ1GUIyKN0eO8HF/2JsQJG2GhkovgNEmQDTYLELIwNwoK5vmgaErww4CGslPDx1F2ZS7uVqMJcNnD4tp7XAKzCCqmWZNw+1mWRuf#3089b5eda40c7a40171666c6fb2694077b03de2d');
var_dump($crypt->decrypt());
示例6: postSaveCreditcard
public function postSaveCreditcard()
{
$data = array();
$query = DB::table('demographics')->where('pid', '=', Session::get('pid'))->first();
if ($query->creditcard_key == '') {
$key = MD5(microtime());
$data['creditcard_key'] = $key;
} else {
$key = $query->creditcard_key;
}
Crypt::setKey($key);
$data['creditcard_number'] = Crypt::encrypt(Input::get('creditcard_number'));
Crypt::setKey('YourSecretKey!!!');
$data['creditcard_expiration'] = Input::get('creditcard_expiration');
$data['creditcard_type'] = Input::get('creditcard_type');
DB::table('demographics')->where('pid', '=', Session::get('pid'))->update($data);
$this->audit('Update');
echo "Credit Card Information Updated!";
}
示例7: use
* Error handler
*/
set_error_handler(function ($errno, $errstr, $errfile, $errline) use($di) {
if (!(error_reporting() & $errno)) {
return;
}
$di->getFlash()->error($errstr);
$di->getLogger()->log($errstr . ' ' . $errfile . ':' . $errline, Phalcon\Logger::ERROR);
return true;
});
/**
* Encryption service
*/
$di->set('crypt', function () use($config) {
$crypt = new Crypt();
$crypt->setKey('1234');
return $crypt;
});
/**
* Handle the request
*/
$application = new \Phalcon\Mvc\Application();
$application->setDI($di);
/**
* Register application modules
*/
//$application->registerModules(require __dir__ . '/../common/config/modules.php');
// Register the installed modules
$application->registerModules(array('frontend' => array('className' => 'Frontend\\Module', 'path' => '../apps/frontend/Module.php'), 'backend' => array('className' => 'Backend\\Module', 'path' => '../apps/backend/Module.php')));
echo $application->handle()->getContent();
} catch (Phalcon\Exception $e) {