我正在使用jQuery工具提示动态创建行(可以是10行/更多行)
工具提示正在正确显示但关闭不正确.
错误如下,
Error: cannot call methods on tooltip prior to initialization; attempted to call method 'close'
throw new Error( msg );
while(m < 10){
.......................................
.......................................
if(data =="EXIST")
{
display_tp_tooltip(m);
$("#tp_no"+m).val("");
}
else
{
display_tp_tooltip_close(m);
}
}
function display_tp_tooltip(m)
{
$("#tp_no"+m).tooltip();
$("#tp_no"+m).tooltip({
open: function (e, o) {
o.tooltip.animate({ top: o.tooltip.position().top + 10 }, "fast" );
$(o.tooltip).mouseover(function (e) {
$("#tp_no"+m).tooltip('close');
});
$(o.tooltip).mouseout(function (e) {});
},
position: {
my: "center bottom-20",
at: "center top",
using: function( position, feedback ) {
$( …Run Code Online (Sandbox Code Playgroud) jquery compiler-errors jquery-ui dynamic-data twitter-bootstrap
我想使用以下 laravel 函数在 MySQL 中存储当前日期时间。实际上,我存储的是静态日期而不是我想将当前日期时间存储在created_at,updated_at数据库中的字段。
function insert(Request $req)
{
$name=$req->input('name');
$address=$req->input('address');
$data=array("name" => $name,"address" => $address,"created_at"=>'2017-04-27 10:29:59',"updated_at"=>'2017-04-27 10:29:59');
DB::table('student')->insert($data);
echo "Record inserted successfully.<br/>";
return redirect('/');
}
Run Code Online (Sandbox Code Playgroud) 几个月前,我制作了一个简短的代码,用于mb_strimwidth()将一些文本完全适合表格单元格,将点放在截断字符串的末尾.现在,经过一段时间,我试图执行相同的代码,它出现了这个错误:
Fatal error: Call to undefined function mb_strimwidth() in ...
Run Code Online (Sandbox Code Playgroud)
我试图找到mbstring.php文件,当我找到该mb_strimwidth()函数时,我发现它已不再实现了.怎么可能?但我的主要问题是:我怎样才能得到相同的结果mb_strimwidth()?我想用循环重写函数mb_strwidth(),但是mbstring.php文件中的所有函数都是空的.
我正在尝试使用其PlaceID将标记放入Google地图.我有地图工作和显示,还可以添加标记(使用纬度和经度).
下面的代码是我用来尝试使用其placeID使标记显示,但它没有显示.
function addPlaces(){
var marker = new google.maps.Marker({
place: new google.maps.Place('ChIJN1t_tDeuEmsRUsoyG83frY4'),
map: map
});
}
Run Code Online (Sandbox Code Playgroud)
加载地图后调用此函数.
google.maps.event.addDomListener(window, "load", addPlaces);
Run Code Online (Sandbox Code Playgroud) javascript google-maps google-maps-api-3 google-maps-markers google-map-place
在我的代码中,我使用的是typeahead.js.我使用Laravel 5,我需要替换var states我的{{ $jobs }}变量.我需要将所有作业标题列为数组.
在我的控制器中我有
$jobs = Job::all(['job_title']);
Run Code Online (Sandbox Code Playgroud)
我知道javascript中的循环方法,但我不知道如何在javascript中"链接"我的刀片变量.谁知道怎么样?
我试过,在my.js中
var jobs = {{ $jobs }}
Run Code Online (Sandbox Code Playgroud)
但那不行.
所以...我正在测试一些东西并注意到当我运行这段代码时:
$arr = str_split("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890", 1);
print_r(implode(array_rand(array_flip($arr), 16)));
Run Code Online (Sandbox Code Playgroud)
输出是
Refresh 1: BDFIJKPTVkl12789
Refresh 2: HIJKMQWYdfmorsw3
Refresh 3: FGHMNRVYfhknouw5
Refresh 4: AFIJKRSVeiuwx579
Refresh 5: DJORYZcgijlpqry1
Refresh 6: EISWbhjmoqr45689
Refresh 7: CDEFOTXdhkloqr27
Refresh 8: AEFIKLNORSknx349
Refresh 9: DEFHJMTVZcgpstz0
Refresh 10: CLQTZbefhnpq1279
Run Code Online (Sandbox Code Playgroud)
为什么输出每次都以1到5个大写字母开始?这种"随机性"对我来说似乎很奇怪.
我想知道为什么我得到这个结果.
我的html代码是这样的:
<a href="javascript:;" onclick="showAjaxPdf('{{ $row->file_path }}');"><i class="fa fa-file-pdf-o"></i></a>
Run Code Online (Sandbox Code Playgroud)
我的JavaScript代码是这样的:
function showAjaxPdf(file_path)
{
var file_path = file_path.replace(/\\/g,"/");
//example : file_path = assets/images/myfile.pdf
$.ajax({
type: "POST",
data: 'file_path=' + file_path,
url: "news/test",
success: function(response)
{
$('#test').html(response);
}
});
}
Run Code Online (Sandbox Code Playgroud)
我在控制器中的功能测试:
public function postTest(Request $request)
{
$file_path = $request->input('file_path');
return response()->download($file_path);
}
Run Code Online (Sandbox Code Playgroud)
当我单击pdf图标时,没有响应。
我希望当单击pdf图标时显示如下:
单击pdf图标时,图像如何显示?
谢谢
所以,好吧我从验证文档中尝试了很多规则,但都给了我同样的错误说法
数组到字符串转换
这是我添加数组的方式:
$this->validate($request,[
'employee' => 'required|in:'.$employee->pluck('id')->toArray(),
],[
'employee.in' => 'employee does not exists',
]);
Run Code Online (Sandbox Code Playgroud)
有关如何实现这一点的任何提示?
我创建了一个自定义验证器,但仍然传递数组似乎是不可能的
所以,我从Bitbucket导入了另一个项目并尝试使用它启动它php artisan serve,我总是得到这个错误:
[LogicException]
Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" does not
exist or is not readable
Run Code Online (Sandbox Code Playgroud)
我自己创建项目时没有收到此错误,我无法运行任何其他命令.我试过'php artisan key:generate',并得到完全相同的错误.
我试过:composer update,得到了这个:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating spatie/laravel-permission (1.11.1 => 1.12.0) Downloading: 100%
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[LogicException]
Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" doe
s not exist or is not readable
Script php artisan optimize handling the post-update-cmd …Run Code Online (Sandbox Code Playgroud) 这是默认的 Laravelnotifications data字段
{
"type":"Update Appointment",
"appointment_id":"379",
"date":null,
"updated_by":"Mahir",
"status":"2"
}
Run Code Online (Sandbox Code Playgroud)
在controller我想获得所有通知status = 2并将其标记为已读
Laravel 5.3 文档显示
$user = App\User::find(1);
foreach ($user->unreadNotifications as $notification) {
$notification->markAsRead();
}
Run Code Online (Sandbox Code Playgroud)
我如何修改它以获取所有通知 status = 2
更新:寻找这样的东西
$noti = $user->unreadNotifications->where('data->status',"2");
Run Code Online (Sandbox Code Playgroud)
注意:我的数据库不支持json数据类型。
laravel ×7
php ×6
javascript ×3
arrays ×2
laravel-5 ×2
ajax ×1
download ×1
dynamic-data ×1
google-maps ×1
jquery ×1
jquery-ui ×1
laravel-5.2 ×1
laravel-5.3 ×1
mbstring ×1
mysql ×1
oauth-2.0 ×1
pdf ×1
php-carbon ×1
random ×1
string ×1
truncation ×1
validation ×1