You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
953 B
41 lines
953 B
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace longbingcore\tools;
|
|
|
|
|
|
class LongbingDefault
|
|
{
|
|
public static $avatarImgUrl = '' ;
|
|
public static $notImgUrl = '' ;
|
|
|
|
|
|
/**
|
|
* @param $data
|
|
* @param $target
|
|
* @param $default
|
|
* @param $defaultArr
|
|
* @功能说明: 格式换默认图片
|
|
* @author jingshuixian
|
|
* @DataTime: 2020/1/17 11:32
|
|
*/
|
|
public static function formatDefaultImage ( $data, $target, $default, $defaultArr )
|
|
{
|
|
|
|
foreach ( $data as $index => $item )
|
|
{
|
|
if ( is_array( $item ) )
|
|
{
|
|
$data[ $index ] = formatDefaultImage( $item, $target, $default, $defaultArr );
|
|
}
|
|
else
|
|
{
|
|
if ($index == $target && $item == '' && isset($defaultArr[$default]))
|
|
{
|
|
$data[$index] = $defaultArr[$default];
|
|
}
|
|
}
|
|
}
|
|
return $data;
|
|
}
|
|
} |