出现此错误,并且不理解..提前感谢您的帮助:D
信息:
- Symfony 3
- Ubuntu 15.x
Attempted to call function "mcrypt_create_iv" from namespace "AppBundle\Controller".
使用和上课:
<?php
namespace AppBundle\Controller;
use AppBundle\Entity\Logs;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Filesystem\Filesystem;
class FileController extends Controller
{
我的功能:
protected function encrypt ($payload, $key) {
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM);
$crypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $payload, MCRYPT_MODE_CBC, $iv);
$combo = $iv . $crypt;
$garble = base64_encode($iv . $crypt);
return $garble;
}
我称之为:
public function getPrivateDirectoryAction($returnPath = false, Request $request)
{
$user = $this->getUser();
if ($request->request->get('path') != null){
$fullPath = $request->request->get('path');
} else {
if($returnPath){
$fullPath = $returnPath;
} else {
$path = $this->getUser()->getPath();
$dir = $this->ftpDirectory;
$fullPath = $dir.$path;
}
}
$finder = new Finder();
$files = $finder->in($fullPath);
$this->generateLogAction($user, $fullPath, 'null', 'access');
$files = iterator_to_array($files->getIterator());
foreach($files as $key => $value) {
$value->path_crypted = $this->encrypt($value->getPath(), 'secret') . '||' . $this->encrypt($value->getBasename() , 'secret');
}
return $this->render('File/index.html.twig', array(
'files' => $files,
'path' => $fullPath
));
}
(它在同一个班级......)
如果有人可以帮助我,请解释你是如何做到的。我的英语真的很糟糕:D
编辑:
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
mcrypt support enabled
mcrypt_filter support enabled
Version 2.5.8