Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php zend框架和条令2-将图像从数据库保存并下载到图像字段_Php_Zend Framework_Doctrine - Fatal编程技术网

Php zend框架和条令2-将图像从数据库保存并下载到图像字段

Php zend框架和条令2-将图像从数据库保存并下载到图像字段,php,zend-framework,doctrine,Php,Zend Framework,Doctrine,我在一个应用程序中使用zf和doctrine 2,我在尝试将图像保存到数据库中的一个字段并从mysql blob字段下载图像时遇到问题 有没有人能举一个我可以借鉴的小例子 谢谢我认为: 这正是你想要的。由于默认情况下不支持blob数据类型,因此可以将自己的数据类型添加到Doctrine2。使用链接中的示例,可以为blob字段设置@Column(type=“blob”) 如果使用Bisna胶水集成Doctrine2和ZF,您可以在引导程序中执行以下操作: <?php protected fu

我在一个应用程序中使用zf和doctrine 2,我在尝试将图像保存到数据库中的一个字段并从mysql blob字段下载图像时遇到问题

有没有人能举一个我可以借鉴的小例子

谢谢

我认为:

这正是你想要的。由于默认情况下不支持blob数据类型,因此可以将自己的数据类型添加到Doctrine2。使用链接中的示例,可以为blob字段设置@Column(type=“blob”)

如果使用Bisna胶水集成Doctrine2和ZF,您可以在引导程序中执行以下操作:

<?php
protected function _initDoctrineExtraDatatypes() {
    $this->bootstrap('doctrine');

    $doctrine = $this->getPluginResource('doctrine');
    $em = $doctrine->getEntityManager();

    // types registration
    Doctrine\DBAL\Types\Type::addType('blob', 'Doctrine\DBAL\Types\Blob');
    $em->getConnection()->getDatabasePlatform()->registerDoctrineTypeMapping('BLOB', 'blob');        

    //off course you could ask some more types here you want to be integrated.
}
?>

祝你好运