【发布时间】:2015-12-31 16:15:57
【问题描述】:
我目前在我的控制器中有这段代码,它显示一组记录这里是我的代码
public function view()
{
$title = "View Guardian Information";
$vPa = DB::table('dbo_guardianinformation')
->join('dbo_cities', 'dbo_guardianinformation.CityID', '=' , 'dbo_cities.CityID')
->select('dbo_guardianinformation.ParentAccountID','dbo_guardianinformation.FirstName','dbo_guardianinformation.LastName','dbo_guardianinformation.Roles',
'dbo_guardianinformation.Address','dbo_cities.CityName','dbo_guardianinformation.Status','dbo_guardianinformation.EmailAddress')
->get();
//encrypt decrypt algo
// $sptkey = md5('sample_encryptkey');
// $enPass = rtrim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $sptkey, $defPass, MCRYPT_MODE_ECB)));
// $decPass = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $sptkey, base64_decode($enPass), MCRYPT_MODE_ECB));
return View::make('ssims.view_parentAccount',compact('title','vPa'));
}
我的问题是列dbo_guardianinformation.Address包含加密记录我目前不知道我应该将解密代码放在哪里,以便当$vPa 将被传递到它已经包含解密记录的视图时。有任何想法吗?感谢任何愿意提供帮助的人
【问题讨论】:
-
在我看来,您已经在我认为有意义的地方注释掉了解密代码,即在您填写
$vPa之后但在您构建视图之前。您是否尝试取消注释该代码并使其正常工作? -
我这样做时遇到了问题。我想了一个办法,因为
dbo_guardianinformation.Address列包含加密数据,我试图创建一个循环来解密所有没有成功的记录 -
好的,很酷。那么,您可以在问题中添加那个代码吗?
-
我通过使用 foreach 得到了答案 :) 感谢您的建议! :)
标签: php laravel encryption laravel-4 cryptography