2

我有课,我想初始化存储带有“blob”类型的图片的列,但我不确定如何?看一下代码的纬度行

  public function __construct( $data=array() ) {
    if ( isset( $data['id'] ) ) $this->id = (int) $data['id'];
    if ( isset( $data['date'] ) ) $this->date= (int) $data['date'];
    if ( isset( $data['topic'] ) ) $this->topic = preg_replace ( "/[^\.\,\-\_\'\"\@\?\!\:\$ a-zA-Z0-9()]/", "", $data['topic'] );
    if ( isset( $data['author'] ) ) $this->author = preg_replace ( "/[^\.\,\-\_\'\"\@\?\!\:\$ a-zA-Z0-9()]/", "", $data['author'] );
    if ( isset( $data['content'] ) ) $this->content = $data['content'];
    if ( isset( $data['picture'] ) ) $this->picture ="Here sholud be the Type" $data['picture'];
  }
4

1 回答 1

3

在 PHP 中,二进制数据也存储在字符串中。

所以只需初始化它$this->picture = $data['picture'];

于 2012-04-05T05:37:11.330 回答