任何人都可以向我解释如何使用preg_split()函数?我不明白这样的模式参数"/[\s,]+/".
例如:
我有这个主题:is is.我希望结果如下:
array (
0 => 'is',
1 => 'is',
)
Run Code Online (Sandbox Code Playgroud)
所以它会忽略空间和全程,我怎么能这样做?
我正在尝试使用bootstrap验证器验证表单,但文件验证不正常,这是我的代码:
cv: {
validators: {
file: {
extension: 'doc,docx,pdf,zip,rtf',
type: 'application/pdf,application/msword,application/rtf,application/zip',
maxSize: 5120 * 5120 * 5120 * 5120 * 5120, // 5 MB
message: 'The selected file is not valid, it should be (doc,docx,pdf,zip,rtf) and 5 MB at maximum.'
},
notEmpty: {
message: 'CV is required.'
}
}
},
Run Code Online (Sandbox Code Playgroud)
所需的文件扩展名是doc,docx,pdf,rtf,zip,如上所示,但它只接受3个扩展名:doc,rtf,pdf ...所以我的代码中的错误在哪里?
我有一个带定时器的函数,我想在另一个函数的定时器完成时调用另一个函数,所以第一个函数将显示一个模态 3 秒,另一个函数将显示另一个模态,这是我的代码:
var fn = setTimeout(function(){
$('#responseModal').modal('hide');
return true;
}, 3000);
if(fn)
$('#requestModal').modal('show');
Run Code Online (Sandbox Code Playgroud) 我想通过点击按钮来调整屏幕亮度,所以当背景为白色时,屏幕亮度应该是最大的,同时如果背景为黑色,屏幕亮度应该是最小的,但是我得到一个错误:NullPointerException ...这里是我的代码:
public void lamp2(boolean mode){
if(mode){
r.setBackgroundColor(Color.WHITE);
btn.setText("Turn OFF");
btn.setTextColor(Color.RED);
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 90 / 100.0f;
getWindow().setAttributes(lp);
this.mode = true;
}
else if(!mode){
r.setBackgroundColor(Color.BLACK);
btn.setText("Turn ON");
btn.setTextColor(Color.GREEN);
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.screenBrightness = 100 / 100.0f;
getWindow().setAttributes(lp);
this.mode = false;
}
}
Run Code Online (Sandbox Code Playgroud) 我要放三米的div为了如下:input,break,ouput.而他们的父母就是container.我在为这些div应用box-sizing时遇到问题,这是我的css:
html {
border: groove 8px red;
margin: 20px;
}
.container {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
height:75%;
}
.container .input {
width: 49%;
height: 100%;
border: solid 2px red;
float: left;
}
.container .break {
width: 2%;
height: 100%;
background: blue;
float: left;
}
.container .output {
width: 49%;
height: 100%;
border: solid 2px green;
float: right;
}
Run Code Online (Sandbox Code Playgroud) 我想在 Yii 的视图页面中执行查询,这是我的代码:
$connection=Yii::app()->db;
$connection->active=true;
$sql = "insert into news(idNews, news, display) values('', 'anything', 0)";
$command=$connection->createCommand($sql);
$command->execute();
Run Code Online (Sandbox Code Playgroud)
但什么也没发生,我的代码有什么错误?
javascript ×2
php ×2
android ×1
brightness ×1
css ×1
html ×1
jquery ×1
mysql ×1
preg-split ×1
screen ×1
sql ×1
timer ×1
validation ×1
yii ×1