我有这条线.
$line = '/opt/fings/interface/20140905111645811106.txt 0';
Run Code Online (Sandbox Code Playgroud)
我用它来绊倒尾随0/r/n.
$pos = strpos($lines[$x], ' ');
$file = '.'.substr($lines[$x], 0, $pos);
Run Code Online (Sandbox Code Playgroud)
所以我留下了这个 /opt/fings/interface/20140905111645811106.txt
但我需要单独的文件名.例如20140905111645811106.txt
何我从背面抓到第一次出现的斜线?
为什么我会收到这个错误?我需要选择这两个不同的,但我在这里编码错了吗?
ERROR: syntax error at or near "DISTINCT"
SELECT DISTINCT(mfin_score), DISTINCT(empirica_score ) from account_details
Run Code Online (Sandbox Code Playgroud) 我试图将我们当前的应用程序迁移到Laravel-5.
这个应用程序有一个很大的结构,有很多表,但不到一半的表有一个primary key被调用id.
这是一个问题还是您可以手动指定您希望调用主键的内容.
它只是从我正在做的训练视频,它似乎没有.
有没有办法像下面那样一次性完成( toLowerCase 和 includes )?
let x = this.state.outreach.arival.toLowerCase(includes("likely"))
Run Code Online (Sandbox Code Playgroud) 我试图将数据库中的选定值加载到我的多选框中.
当我最初从数据库加载选项时,它工作得很完美.
但我想为此rrecord 添加SELECTED项目.我尝试了一些方法,有点像这样的hacky.
var keywordArray = new Array();
keywordArray = test[0].keyword.split(",");
for( var x = 0; x < keywordArray.length ; x++){
foundKeyword = $( "select" ).find("option[value="+keywordArray[x]+"]").text();
$('.select2-choices').prepend("<li class='select2-search-choice'><div>" + foundKeyword + "</div><a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>");
$('.select2-search-field input').attr("aria-activedescendant","select2-result-label-25");
$('.select2-search-field input').css("width", "10px");
$('.select2-search-field input').removeClass("select2-default");
}
Run Code Online (Sandbox Code Playgroud)
这可以是它的完成方式,而且它不能正常工作

即使SELECTED关键字似乎在那里.您无法删除它们,并且下拉列表中的关联值仍可选择(不显示为灰色).
我已经尝试过一个网上的例子,但是没有用
var pills = [{id:0, text: "ECHO"}, {id:1, text: "BRAVO"}];
$('#media_keywords').select2({
placeholder: "Select a pill",
data: function() { return {results: pills}; }
});
Run Code Online (Sandbox Code Playgroud)
所以我的问题是,如何从数据库加载SELECTED数据并刷新或重新初始化select2所选区域?这还需要禁用已选择项目的选择功能.
与此FIDDLE类似,您将如何在加载时显示多个选定值?
<select multiple>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</select>
$('select').select2().select2('val','3')
Run Code Online (Sandbox Code Playgroud)

需要显示类似于ON LOAD的东西

我对这个WHERE条款有疑问
在查询中我想说
SELECT ...
FROM ...
WHERE link.hos_id = $hos_id
AND outcome.otc_otrdischargedate = $td
AND outcome.otc_outcome LIKE ['%ICU%', '%I.C.U%', '%L3%']
Run Code Online (Sandbox Code Playgroud)
但相反,它读起来像这样
SELECT ...
FROM ...
WHERE link.hos_id = $hos_id
AND outcome.otc_otrdischargedate = $td
OR outcome.otc_outcome LIKE ['%ICU%', '%I.C.U%', '%L3%']
Run Code Online (Sandbox Code Playgroud)
如何将laravel查询结构化为像第一个例子那样读取?
$matchThese = ['link.hos_id' => $hos_id, 'outcome.otc_otrdischargedate' => $td];
$icu = DB::table('link')
->join('demographic', 'link.lnk_dmgid', '=', 'demographic.dmg_id')
->join('admission', 'link.lnk_admid', '=', 'admission.adm_id')
->join('outcome', 'link.lnk_otcid', '=', 'outcome.otc_id')
->where($matchThese)
->orWhere('outcome.otc_outcome', 'like', '%ICU%')
->orWhere('outcome.otc_outcome', 'like', '%I.C.U%')
->orWhere('outcome.otc_outcome', 'like', '%L3%')
->orWhere('outcome.otc_outcome', 'like', '%Level3%')
->orWhere('outcome.otc_outcome', 'like', …Run Code Online (Sandbox Code Playgroud) 我的查询有问题
当我像这样运行它时,我得到所有组织的所有组和项目(表项).它的意思是只从org_id它们可见的地方获取它们.
return $this->model->with( [ 'items' => function($query){$query->where('invisible','=',FALSE)->orWhere('invisible', '=', null)->orderBy('description', 'ASC');} ] )->where("org_id",$org_id)->where('invisible','=',FALSE)->orWhere('invisible', '=', null)->orderBy('description', 'asc')->get();
Run Code Online (Sandbox Code Playgroud)
如果我像这样运行它(删除invisible组的查询)它工作正常.
return $this->model->with( [ 'items' => function($query){$query->where('invisible','=',FALSE)->orWhere('invisible', '=', null)->orderBy('description', 'ASC');} ] )->where("hos_id",$hos_id)->orderBy('description', 'asc')->get();
Run Code Online (Sandbox Code Playgroud)
我是怎么做的
WHERE orf_id= org_id
AND ( invisible = false OR invisible = NULL )
Run Code Online (Sandbox Code Playgroud) 如果这是一个愚蠢的问题,我很抱歉,但实际上我不知道.
我编写了这个应用程序来压缩文件并将文件从客户端PC移动到主PC.
它可以很好地用作网页.这几乎没有指导,没有规范文档.
因为命运会有它,它应该是一个通过调用运行的cron作业
*****runScript.php
所以我不知道执行将会或应该以何种顺序执行.
我使用了2个AJAX调用来调用脚本中的方法,但是只是将脚本作为脚本运行就有点不同了.
有人可以指导我吗?
例如,是否存在将首先调用的MAIN方法.如果是这样,那么我可以从那里引导脚本.
更新
答案真的很有帮助,但是php文件怎么会受到影响?@Ole Haugset提到我应该调整它以便使用$_GETvars.例如,这已在脚本中完成if ($_GET["argument"]=='runScript'){}.
所以附加runScript到脚本调用应该可以正常工作?
例如 * * * * * php /path/to/file/runScript.php runScript
JQuery.Validation是如何unhighlight调用的?
我有一份正在验证的表格。我捕获了所有应该捕获的内容(ip、电话、电子邮件)
但由于某种原因,我的两个<select>自动转换为框的下拉Select2菜单不太友好。
打开表格。单击保存。所有的气泡都会弹出来说明哪个或什么出了问题。
开始填写它们,当您输入有效值时它们开始消失。
然而,对于Select2盒子来说,这种情况不会发生。
jQuery(function($) {
var validator = $('#form').validate({
rules: {
x: {
required: true
}
},
messages: {},
errorPlacement: function(error, element) {},
highlight: function(element, errorClass, validClass) {
var v = $(element).val();
$(element).siblings(".err").addClass('bubble');
if (v == '') {
$(element).siblings(".err").html('Required field')
}
if (v != '') {
$(element).siblings(".err").html('Please check format')
}
},
unhighlight: function(element, errorClass, validClass) {
$(element).siblings(".err").removeClass('bubble');
$(element).siblings(".err").html('')
}
});
});Run Code Online (Sandbox Code Playgroud)
form {
margin-top: 30px;
}
input.myerror {
margin-top: …Run Code Online (Sandbox Code Playgroud)jquery ×3
laravel ×2
php ×2
cron ×1
eloquent ×1
javascript ×1
laravel-5 ×1
migration ×1
postgresql ×1
select ×1