小编B L*_*een的帖子

array_map内联匿名函数

在这里测试了内联匿名函数array_map

并且它工作但当我尝试使用$ user_meta它不起作用.

$user_meta = Array ( [interest] => Array ( [0] => Array ) [type] => 
     Array ( [0] => Array ) [user_status] => Array ( [0] => deny)
     [firstname] => Array ( [0] => ) [lastname] => Array ( [0] => B ) 
     [email] => email@cc.com ) 

$user_meta = array_map(function($a) { return $a[0]; },$user_meta);
Run Code Online (Sandbox Code Playgroud)

"解析错误:语法错误,意外的T_FUNCTION,期待')'in"

这是显示错误的测试链接

php array-map

26
推荐指数
3
解决办法
4万
查看次数

使用 Laravel Eloquent 获取所有最新记录

我尝试以这种方式查询数据库,但它返回错误。

最新()未找到。

DailyReport::get()->latest()->paginate(10)
Run Code Online (Sandbox Code Playgroud)

我希望它返回所有带分页的 DailyReports。

laravel eloquent laravel-query-builder

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

CSS文字溢出省略号+以%表示的宽度不起作用

仅当宽度以像素为单位且不接受百分比时,文本溢出才会起作用。我在使用Firefox时遇到问题,不了解其他浏览器。

<div class="items">
    <div class="item">
            <div class="name">Title Long Long Long Long Long 1</div>
            <div class="desc">Lore Lipsum Lore Lipsum Lore Lipsum Lore Lipsum Lore Lipsum Lore Lipsum</div>
    </div>
    <div class="item">
        <div class="name">Title Long Long Long Long Long 2 </div>
        <div class="desc">Lore Lipsum Lore Lipsum Lore Lipsum Lore Lipsum Lore Lipsum Lore Lipsum</div>
    </div>
</div>

.items {
   width:30%;
}
.item {
  display:table;
}
.item .name ,.item .desc  {
  display:table-cell;
        white-space: nowrap;
    text-overflow: ellipsis;    
    overflow: hidden;   
}
.item .name {
    width:20%;
}
.item …
Run Code Online (Sandbox Code Playgroud)

css3

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

如何在laravel中检查文件是否上传

我正在将图像文件上传到输入文件ImageUpload。我需要检查文件是否已上传,然后创建一个唯一的文件名并将其保存在服务器上。

$file = $request->file('ImageUpload');
$filename=uniqid($user->id . '_'    ).".".$file->getClientOriginalExtension();
Storage::disk('public')->put($filename,File::get($file));
Run Code Online (Sandbox Code Playgroud)

laravel laravel-validation

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

查找坐标以在圆内绘制正方形

如何计算在圆心内绘制正方形的起始坐标?

功能绘制圆形光谱。现在帮助我找到在圆内绘制矩形的起始坐标

Gradient.prototype.renderSpectrum = function() {
    var radius = this.width / 2;
    var toRad = (2 * Math.PI) / 360;
    var step = 1 / radius;

   this.ctx.clearRect(0, 0, this.width, this.height);

    for(var i = 0; i < 360; i += step) {
        var rad = i * toRad;
        this.ctx.strokeStyle = 'hsl(' + i + ', 100%, 50%)';
        this.ctx.beginPath();
        this.ctx.moveTo(radius, radius);
        this.ctx.lineTo(radius + radius * Math.cos(rad), radius + radius * Math.sin(rad));
        this.ctx.stroke();
    }

   this.ctx.fillStyle = 'rgb(255, 255, 255)';
   this.ctx.beginPath();
   this.ctx.arc(radius, radius, radius …
Run Code Online (Sandbox Code Playgroud)

html5 html5-canvas

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

使用Jquery的圆形滑块

如何将鼠标滑动到圆形?在画布中绘制圆弧和鼠标指针.鼠标应该在圆形路径上拖拽山墙?

//function to create mouse event to drag the mouse hover the arc

function mousedrag() {
    var canvasoffset = $(this.canvas).offset();
    var offsetX = canvasoffset.left;
    var offsetY = canvasoffset.top;     
    var mouseX = parseInt(e.offsetX || e.clientX - offsetX);
    var mouseY = parseInt(e.offsetY || e.clientY - offsetY);

    var radius = this.width / 2;
    var twoPI = 2 * Math.PI;
    var toRad =  twoPI / 360;
    var r_width =  this.width * 0.8;

    var radial_Angle = Math.atan2(mouseY - radius,mouseX - radius);

    var p_side_x =  radius …
Run Code Online (Sandbox Code Playgroud)

jquery-slider html5-canvas

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

Facebook Javascript SDK FB未定义

FB not defined使用Facebook Javascript SDK时出错

FB.init({
    appId: '{APP ID}',
    status: true,
    cookie: true,
    xfbml: true
});
Run Code Online (Sandbox Code Playgroud)

的jsfiddle

javascript facebook facebook-graph-api facebook-javascript-sdk

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

供应商文件丢失

我需要重新加载所有供应商文件.如何使用composer安装供应商?我正在从GitHub安装一个缺少供应商文件的软件包https://github.com/jacurtis/Packt-Laravel-Socialite

vendor laravel

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

提取数字形成货币 $100

如何从一个数字中提取唯一的数字 currency $100?

这不起作用preg_match_all('/(\d+.?\d+)/',$price,$matches); 比赛[1] 为空

我没有任何其他可能性从字符串中提取数字

php

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

日期格式为2019-06-17T9:45:04Z

如何以格式获取日期

2019-06-17T9:45:04Z 
Run Code Online (Sandbox Code Playgroud)

在PHP?

我试过了

date("Y-m-dTH:i:sZ") 
Run Code Online (Sandbox Code Playgroud)

它正在回归

2019-02-03UTC09:23:560
Run Code Online (Sandbox Code Playgroud)

php date

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