代码拉取完成,页面将自动刷新
使用方法参考官方 https://github.com/fzaninotto/Faker 以下是修改过的内容
$faker = \Faker\Factory::create('zh_CN');
$faker->imageUrl(rand(100, 300), rand(100, 300));
/**
* 生成将返回随机图像的URL
*
* @param integer $width 宽度
* @param integer $height 高度
* @param string $category 分类 'any', 'animals', 'architecture', 'people', 'nature', 'tech',
* @param string|null $filter 'grayscale', 'sepia'
* @param bool $https 是否使用https协议
*
* @return string
* @example 'http://placeimg.com/640/480/any'
*
*/
public static function imageUrl($width = 640, $height = 480, $category = 'any', $filter = null, $https = false)
{
$url = ($https ? 'https' : 'http') . "://placeimg.com/{$width}/{$height}";
if (!in_array($category, static::$categories)) {
throw new \InvalidArgumentException(sprintf('Unknown image category "%s"', $category));
}
$url .= "/{$category}";
if($filter){
if (!in_array($filter, static::$filters)) {
throw new \InvalidArgumentException(sprintf('Unknown image filter "%s"', $filter));
}
$url .= "/{$filter}";
}
return $url;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。