图片:
我想编码这个图像!
一个简单的代码:(有问题)
.hr{
position:relative;
height:100px;
background : #ddd;
clear both;
margin-top: 100px ;
}
.vr{
position:absolute;
width:100px;
height:900px;
background : #000;
top:-300px;
z-index:-1
}
<div class='hr' style=''><div class='vr' style='left:100px;'></div><div class='vr' style='right:100px;z-index:0'></div></div>
<div class='hr' style=''></div>
Run Code Online (Sandbox Code Playgroud)
..............
\App\Post :
function PostMeta(){
return $this->hasMany('App\PostMeta');
}
Run Code Online (Sandbox Code Playgroud)
而我的查询:( pluck 不起作用)-
我需要使用较少的数据库查询
$query = \App\Post
::with(array('PostMeta'=>function($query){
$query->pluck('key','value');
}));
$query->get();
Run Code Online (Sandbox Code Playgroud)
我需要得到title_en,但我不能在这里使用 pluck!
解决了:
function get_PostMeta(){
// print_r($this->relations['PostMeta']);
return $this->relations['PostMeta'];
}
$query = \App\Post::with('PostMeta')->get();
foreach ($query as $key => $post){
$post->meta = $post->get_PostMeta()->pluck('value', 'key');
}
Run Code Online (Sandbox Code Playgroud) 我使用了很多很多关系.我想为此属性设置两个值.
产品,
属性
attribute_product => product_id,attribute_id,value
我知道这是错的,但我想告诉你我想要的
$product->attributes()->sync([
1 => [
'value' => 'sky'
],
1 => [
'value' => 'night'
],
]);
Run Code Online (Sandbox Code Playgroud)
更新2
Schema::create('attribute_product', function (Blueprint $table) {
$table->unsignedInteger('product_id');
$table->unsignedInteger('attribute_id');
$table->text('value')->nullable();
$table->integer('devalue_id')->nullable(); // value id
$table->primary(['product_id', 'attribute_id', 'devalue_id']);
});
Run Code Online (Sandbox Code Playgroud)
更新1
我需要设置天空,晚上
product_id attribute_id value devalue_id
1 1 sky 1
1 1 night 2
...
Run Code Online (Sandbox Code Playgroud) 我试图模糊第一个像第三个图像,但我不能这样做!:(
header('Content-Type: image/jpeg');
$image = imagecreatefromjpeg('1.jpg');
for ($x=1; $x<=40; $x++){
imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR,999);
}
imagefilter($image, IMG_FILTER_SMOOTH,99);
imagefilter($image, IMG_FILTER_BRIGHTNESS, 10);
imagejpeg($image);
imagedestroy($image);
Run Code Online (Sandbox Code Playgroud)
如何在Wordpress中检查帖子是否已更新?
if (post_has_edit())
the_modified_time();
else
the_time();
Run Code Online (Sandbox Code Playgroud)
有没有这样的功能post_has_edit()?
当按住下一个按钮时,音频播放器会变得更快......
代码代表一切
主要问题:如何继续正常?
这是我的尝试
jQuery
$(function () {
var audio = document.getElementById('mine');
audio.addEventListener('durationchange', function (e) {
$('.btn-forward').mousedown(function () {
setInterval(function () {
audio.currentTime += 10;
}, 200);
}).mouseup(function () {
// Continue to normal
});
$('.btn-backward').mousedown(function () {
setInterval(function () {
audio.currentTime += 10;
}, 200);
}).mouseup(function () {
// Continue to normal
});
});
});
Run Code Online (Sandbox Code Playgroud)
等候接听 !<3
php ×4
laravel ×2
css ×1
html ×1
imagefilter ×1
javascript ×1
jquery ×1
laravel-5.4 ×1
many-to-many ×1
structure ×1
wordpress ×1