小编dan*_*oli的帖子

在css中编写不同的结构

图片:

在此输入图像描述

我想编码这个图像!

一个简单的代码:(有问题)

.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)

..............

css structure

8
推荐指数
1
解决办法
61
查看次数

laravel 一起使用 with() , pluck()

查询输出

\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)

php laravel

6
推荐指数
1
解决办法
8258
查看次数

Laravel多对多

我使用了很多很多关系.我想为此属性设置两个值.

产品,

属性

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)

php many-to-many laravel laravel-5.4

5
推荐指数
1
解决办法
692
查看次数

php - 模糊图像的最佳方式

我试图模糊第一个像第三个图像,但我不能这样做!:(

 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)

图像

php imagefilter

4
推荐指数
1
解决办法
6449
查看次数

Wordpress - 检查帖子是否有更新

如何在Wordpress中检查帖子是否已更新?

if (post_has_edit())
    the_modified_time();
else
    the_time();
Run Code Online (Sandbox Code Playgroud)

有没有这样的功能post_has_edit()

php wordpress last-modified

3
推荐指数
1
解决办法
1371
查看次数

音频控制 - 后退、前进按钮 - Java 脚本

当按住下一个按钮时,音频播放器会变得更快......

代码代表一切

主要问题:如何继续正常?

这是我的尝试

http://jsfiddle.net/1t6g8oLg/

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

html javascript jquery

1
推荐指数
1
解决办法
1450
查看次数