update
This commit is contained in:
@ -7,6 +7,13 @@ class ArticleHelper
|
|||||||
{
|
{
|
||||||
public static function saveImagesFromArticle(string $html, string $savePath = '/www/wwwroot/uploads/', string $srcPrefix = '/uploads/')
|
public static function saveImagesFromArticle(string $html, string $savePath = '/www/wwwroot/uploads/', string $srcPrefix = '/uploads/')
|
||||||
{
|
{
|
||||||
|
if (!$savePath) {
|
||||||
|
$savePath = env('UPLOAD_ROOT', '');
|
||||||
|
if (!$savePath) {
|
||||||
|
throw new \Exception('找不到存储图片的路径信息。');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 创建保存图片的目录,如果没有的话
|
// 创建保存图片的目录,如果没有的话
|
||||||
if (!file_exists($savePath)) {
|
if (!file_exists($savePath)) {
|
||||||
mkdir($savePath, 0777, true);
|
mkdir($savePath, 0777, true);
|
||||||
|
Reference in New Issue
Block a user