在Symfony2中使用Imagick吗? [英] Using Imagick in Symfony2?
问题描述
我正在尝试将Imagick与Symfony2一起使用,但是每次尝试使用它时,都会出现以下错误:
I am trying to use Imagick with Symfony2, but every time I try and use it, it gives me the following error:
Fatal error: Class 'Acme\TestBundle\Services\Imagick' not found...
我在我已设置用于管理图像的服务中使用Imagick.我需要做什么才能使用该类?
I am using Imagick in a service I have setup to manage my images. What do I need to do to be able to use this class?
我可以确认Imagick扩展程序正在服务器上运行并且已被其他站点使用.
I can confirm the Imagick extension is working on the server and is in use by other sites.
在此先感谢您的帮助.
推荐答案
实例化Imagick类时,请使用完整的类名:
When you instantiate the Imagick class, use a full quallified class-name:
new \Imagick;
这将使PHP不在当前名称空间中查找类Imagick
.
This will make PHP not look for the class Imagick
within the current namespace.
有关更详细的说明,请参见类似的问题/答案:如何使用php的"root"命名空间?.
For a more detailed explanation see a similar Question/Answer: Problems with PHP namespaces and built-in classes, how to fix? and How to use "root" namespace of php?.
这篇关于在Symfony2中使用Imagick吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!