在 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 'AcmeTestBundleServicesImagick' 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 命名空间和内置类的问题,如何解决? 和 如何使用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屋!