只要前端给传个方法就好了都不用他们 干掉前端不是梦
![c09bd14c231365de0d6bf1c572c48718.png](https://i-blog.csdnimg.cn/blog_migrate/33944efb0cbe3a12bf9e1acdee8583ba.jpeg)
发现前端是用bootstrap框架 那好 那我就去bootstrap框架去找方法
![db8a1308c462eeee2f32735fcf98caf7.png](https://i-blog.csdnimg.cn/blog_migrate/8619380f1bd2520450bee7ccde612fc2.png)
怎么输出直接定义出来 前端就这么欧克了
在来看看后端咱们是怎么定义图片大小的
![ccde37a75a13be5522c269add4f35cb8.png](https://i-blog.csdnimg.cn/blog_migrate/b4349d307dc6e32ceb305c0a25ce05d3.jpeg)
根据ui设计的首页就先展示图片和价格就好
$hashids = new LibHashids(C('PWD_KEY'), C('URL_ID'));
其中调用这个方法 俩个大C都i是载数据库中定义了
![31614a07fc9565dd10af2a75b9cff5ad.png](https://i-blog.csdnimg.cn/blog_migrate/8512180b1f8a3865aa9fdd1fe4a8280d.jpeg)
到关键的时候了
![7115da1e3f1c5db445dbbd0e7abedeba.png](https://i-blog.csdnimg.cn/blog_migrate/9904233fb542fa8b219c6212269431e5.jpeg)
在调用resize方法是设计图片大小的 大小也是在数据库中设计好的
![578db8e8e53323b8435c0d937e68fb4a.png](https://i-blog.csdnimg.cn/blog_migrate/8642d0a1d3f5a911c967d181888893f7.png)
都是255 就可以了
细心的你会发现那你foreach下面那个goods_id 是干嘛用的呢
![700819aa9bb55cd8d167fd8932428e7c.png](https://i-blog.csdnimg.cn/blog_migrate/1fe2f2c1e5851f0de2dbc33dfe8ffa72.jpeg)
那我就直接给你看下吧 在数据库中id都是递增的 但最好不要那样 会给攻击你的网站的人会很方便的 那我给大家打印下这都是什么
![de0feb526e7a945591fd39adcb96fc4c.png](https://i-blog.csdnimg.cn/blog_migrate/3342a60be27742266b9924160356c2c6.png)
你可能觉得我这个是随机数 那你错了 上代码
![3322f331f3b2728ec1270292454fcd3b.png](https://i-blog.csdnimg.cn/blog_migrate/3d83907fb3a016701d9c0f963cb19e76.jpeg)
private function _encode(array $numbers) {
$alphabet = $this->_alphabet;
$numbers_size = sizeof($numbers);
$numbers_hash_int = 0;
foreach ($numbers as $i => $number) {
$numbers_hash_int += ($number % ($i + 100));
}
$lottery = $ret = $alphabet[$numbers_hash_int % strlen($alphabet)];
foreach ($numbers as $i => $number) {
$alphabet = $this->_consistent_shuffle($alphabet, substr($lottery . $this->_salt . $alphabet, 0, strlen($alphabet)));
$ret .= $last = $this->_hash($number, $alphabet);
if ($i + 1 < $numbers_size) {
$number %= (ord($last) + $i);
$seps_index = $number % strlen($this->_seps);
$ret .= $this->_seps[$seps_index];
}
}
if (strlen($ret) < $this->_min_hash_length) {
$guard_index = ($numbers_hash_int + ord($ret[0])) % strlen($this->_guards);
$guard = $this->_guards[$guard_index];
$ret = $guard . $ret;
if (strlen($ret) < $this->_min_hash_length) {
$guard_index = ($numbers_hash_int + ord($ret[2])) % strlen($this->_guards);
$guard = $this->_guards[$guard_index];
$ret .= $guard;
}
}
$half_length = (int)(strlen($alphabet) / 2);
while (strlen($ret) < $this->_min_hash_length) {
$alphabet = $this->_consistent_shuffle($alphabet, $alphabet);
$ret = substr($alphabet, $half_length) . $ret . substr($alphabet, 0, $half_length);
$excess = strlen($ret) - $this->_min_hash_length;
if ($excess > 0) {
$ret = substr($ret, $excess / 2, $this->_min_hash_length);
}
}
return $ret;
}
这些你都不需要看 代码直接分享出来吧
![5579be34d37d8f0cb95ea744c8b8b92c.png](https://i-blog.csdnimg.cn/blog_migrate/01fd9973a55d2b69e87a05c55936d5c0.jpeg)
![6af982cb5440d876d3f3524751361091.png](https://i-blog.csdnimg.cn/blog_migrate/6e1d680b14763084e271f13366b46c28.jpeg)
现在是255*255 那我在给改成200 在看看
![ed125143e0d87ff7034a8918ce3c3be2.png](https://i-blog.csdnimg.cn/blog_migrate/f451d84e3223e810dff5d7ed3b6b55d4.jpeg)
最后和前端接应一下就好了 欧克 想要代码 可私聊 把你邮箱给我 一步到位 不用谢我 叫我一声雷锋就好了