我正在使用 Ubuntu 14.04,我正在尝试安装 Laravel 框架。为此,我在终端中运行了以下代码:
php工匠服务
等了 4-5 分钟后,我得到了这样的回复:
Laravel 开发服务器在http://localhost:8000/上启动
[2015 年 5 月 26 日星期二 13:19:40] 127.0.0.1:44800 [200]: /favicon.ico
[2015 年 5 月 26 日星期二 13:19:40] 127.0.0.1:44801 [200]: /favicon.ico
等了 10 多分钟后,尽管终端正在工作,但我没有收到更多回复。
真的需要那么多时间吗?或者出了什么问题?
我正在学习使用MySQL的OOP PHP.我试图运行一个应该打印返回的行数的查询.我的php代码如下:
$con= mysqli_connect('localhost','root','','dealinte_cms') or die(mysqli_error());
$email="joy1@gmail.com";
if($r=$con->prepare("SELECT * FROM user WHERE email=? ")){
$r->bind_param("s",$email);
if(!$r->execute()){
echo mysqli_errno($con);
}
else{
$rowCount=$r->num_rows;
echo $rowCount;
}
}
Run Code Online (Sandbox Code Playgroud)
在我的数据库中,电子邮件是4行,所以它应该打印4,但它显示0
我的代码有什么问题?
用户应该收到一封格式如下的电子邮件:----- 复制令牌:xxxxx 并将其粘贴到此链接中----- 我的代码:
$message="Copy the token: ".
token_generator(10)." ".
"And paste it in the link "."<a href='recover_pass_get_mail.php'>Link</a>";
Run Code Online (Sandbox Code Playgroud)
其中 xxxxx 由 token_generator(10) 函数返回。但用户获取的格式代码已写入
我有一个JSON对象:
var info=JSON.parse(server_response);
Run Code Online (Sandbox Code Playgroud)
我跑了console.log(info);
并得到了这个输出:
[
[
[
"Dipu",
"Mondal",
"O Positive",
"017xxxx",
"AIS"
]
],
[
[
"dipu",
"Roy",
"O Positive",
"017xxxx",
"Electrical"
]
],
[
[
"Dhinka",
"Chika",
"O Positive",
"9038485777",
"stat"
]
]
]
Run Code Online (Sandbox Code Playgroud)
跟着这个小提琴:http://jsfiddle.net/6CGh8/我试过:
console.log(info.length); //output: 161
console.log(info[0].length); //output: 1
console.log(info[0][1]); //output: undefined
Run Code Online (Sandbox Code Playgroud)
而这3条线的预期输出(分别):
3
5
Dipu
为什么我期待这个:
这个JSON对象包含3个数组,每个数组有5个数据,[0][1]
第th个元素是Dipu
.
如何获得预期的输出?
我有一个字符串用于检查javascript中的正则表达式.该字符串可以包含+8
或仅包含或8
可以是空字符串.但它不能只包含一个+
标志.
这些是有效的: +8
或者(8
或者 ( 3rd one indicates empty string)
This is invalid: +
我试过的代码:
var x=/^\+?(8)?$/.test("+8")? 'ok':'not';
document.write(x);
Run Code Online (Sandbox Code Playgroud)
这段代码一切正常.问题是,如果字符串包含only a + sign
,则此代码返回true,该代码应为false.如何实现我想要的?
我想获取用户ID,姓名,电子邮件.获取ID和姓名但不是电子邮件.我有这个代码:
<html>
<head></head>
body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'xxxxxxxxxxxx',
status : true,
cookie : true,
xfbml : true
});
FB.Event.subscribe('auth.authResponseChange', function(response) {
if (response.status === 'connected') {
testAPI();
} else if (response.status === 'not_authorized') {
FB.login();
} else {
FB.login();
}
});
};
(function(d){
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
ref.parentNode.insertBefore(js, ref);
}(document));
function testAPI() {
FB.api('/me', …
Run Code Online (Sandbox Code Playgroud) 我正在使用MATLAB求解3个线性代数方程.我知道预期的解决方案,其中一个应该是,0
但它正在显示2.2204e-16
.
MATLAB代码:
a=[2 5 -3; 9 2 3; 7 -12 5]
b=[-11; 0; 8]
x=inv(a)*b
Run Code Online (Sandbox Code Playgroud)
预期的解决方案是-1, 0, 3
,但它显示:
-1.0000e+00
2.2204e-16
3.0000e+00
Run Code Online (Sandbox Code Playgroud)
从技术上讲,我没有使用MATLAB软件,而是使用这个在线Octave解释器.
我希望输出正好为0,而不是2.2204e-16
.我该怎么做呢?