我真的很难让PDO在bluemix中使用PHP.我每次收到此错误时都无法使用它:
Fatal error: Class 'PDO' not found in ...
Run Code Online (Sandbox Code Playgroud)
然后我在.bp-config下添加了options.json
{
"PHP_VERSION": "{PHP_55_LATEST}",
"WEB_SERVER": "httpd",
"PHP_EXTENSIONS": [ "bz2", "zlib", "openssl", "fpm", "tokenizer", "curl", "mcrypt", "mbstring", "pdo", "mysqli"]
}
Run Code Online (Sandbox Code Playgroud)
然后我也试过.bp-config下的php.ini
display_errors = On
display_startup_errors = On
extension=pdo.so
extension=pdo_mysql.so
extension=mysqli.so
extension=mysql.so
extension=mbstring.so
Run Code Online (Sandbox Code Playgroud)
并在phpinfo()之后; 我明白了:
'./configure' '--prefix=/tmp/staged/app/php' '--disable-static' '--enable-shared' '--enable-ftp=shared' '--enable-sockets=shared' '--enable-soap=shared' '--enable-fileinfo=shared' '--enable-bcmath' '--enable-calendar' '--with-kerberos' '--enable-zip=shared' '--with-bz2=shared' '--with-curl=shared' '--enable-dba=shared' '--with-cdb' '--with-gdbm' '--with-mcrypt=shared' '--with-mhash=shared' '--with-mysql=shared' '--with-mysqli=shared' '--enable-pdo=shared' '--with-pdo-sqlite=shared,/usr' '--with-pdo-mysql=shared,mysqlnd' '--with-gd=shared' '--with-jpeg-dir=/usr' '--with-freetype-dir=/usr' '--enable-gd-native-ttf' '--with-pdo-pgsql=shared' '--with-pgsql=shared' '--with-pspell=shared' '--with-gettext=shared' '--with-gmp=shared' '--with-imap=shared' '--with-imap-ssl=shared' '--with-ldap=shared' '--with-ldap-sasl' '--with-zlib=shared' …Run Code Online (Sandbox Code Playgroud) 我想通过ajax调用将电子邮件地址插入到我的数据库中.这就是问题所在.它不会在后台工作,而是刷新页面.
alert("yea"); 在成功功能未达成.
可能是什么问题呢?
$(document).ready(function() {
$("#header-subscribe").click(function(){
var str = $("#email").val();
if( validateEmail(str)) {
$.ajax({
url: 'php/signupForm.php',
type: 'GET',
data: 'email='+str,
success: function(data) {
//called when successful
alert("yea");
},
error: function(e) {
//called when there is an error
//console.log(e.message);
}
});
Run Code Online (Sandbox Code Playgroud)
表格:
<form id="hero-subscribe" class="the-subscribe-form" >
<div class="input-group">
<input type="email" class="form-control" placeholder="Enter Your Email" id="email">
<span class="input-group-btn">
<button class="btn btn-subscribe" id="header-subscribe" type="submit">subscribe</button>
</span>
</div>
</form>
Run Code Online (Sandbox Code Playgroud) 有人可以向我解释这种递归是如何工作的吗?我被陷的结果如何是20时,递归只留下上,如果a == b它是a = 6和b = 6
int main()
{
printf("%d \n",mistero(2, 6));
return 0;
}
mistero( a, b)
{
if( a == b ){
return a;
}
return a + mistero(a+1, b);
}
Run Code Online (Sandbox Code Playgroud)