PHP code example of touge / oss-media
1. Go to this page and download the library: Download touge/oss-media library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
touge / oss-media example snippets
//model文件中
/**
* 设置images为json
* @param $images
*/
public function setImagesAttribute($images){
$this->attributes['images'] = json_encode($images,JSON_UNESCAPED_UNICODE);
}
/**
* 取出时为array
* @param $images
* @return array|mixed
*/
public function getImagesAttribute($images)
{
if($images){
return json_decode($images, true);
}
return [];
}
//controller文件中
$form->oss_multiple_image('images')->...