小编Rob*_*cha的帖子

PHP对象序列化和反序列化无法正常工作

我有3个源文件如下:

第一个是source_class.php

class MacMini
{
    public $memory = "16 Gigabytes";
    public $cpu = "Intel Core i7 @ 2.6GHz";
    public $HD = "1TB @ 5200 rpms";
    public function mem()
    {
        return $this->memory;
    }
    public function centralPU()
    {
        return $this->cpu;
    }
    public function hard_drive()
    {
        return $this->HD;
    }
}
Run Code Online (Sandbox Code Playgroud)

////////////////////////////////////////////////// /

第二个是serialize.php

include "source_class.php";
$myMini = new MacMini;
$myMini->cpu = "Intel Core i7 @ 3.4GHz";
$serialized = serialize($myMini);
file_put_contents("store", $serialized);
Run Code Online (Sandbox Code Playgroud)

//////////////////////////////////////////////

第三个是unserialize.php

include "source_class.php";
$data = file_get_contents("store");
$unserialized = unserialize($data);

$myMini = …
Run Code Online (Sandbox Code Playgroud)

php serialization

1
推荐指数
1
解决办法
803
查看次数

jquery(e)函数参数含义

我正在使用Dreamweaver进行jQuery编码,它会自动完成初始jquery选择,如下所示:

$(document).ready(function(e) {

});
Run Code Online (Sandbox Code Playgroud)

"e"在函数定义中的含义是什么?该参数的官方文档是什么?链接有助于官方文档.

jquery

1
推荐指数
1
解决办法
3692
查看次数

MySQL检查是否存在外键约束

如果我有:

create table order_items
( 
  orderid int unsigned not null references orders(orderid),
  isbn char(13) not null,
  quantity tinyint unsigned,

  primary key (orderid, isbn)

);
Run Code Online (Sandbox Code Playgroud)

如何检查orderid int unsigned not null references orders(orderid)外键是否存在?

mysql foreign-keys

1
推荐指数
1
解决办法
4318
查看次数

JavaScript创建并将原型对象分配给另一个对象

我有:

// prototype object
var x = {
    name: "I am x"
};

// object that will get properties of prototype object
var y = {};

// assign the prototype of y from x
y.prototype = Object.create( x );

// check
console.log( y.__proto__ );
Run Code Online (Sandbox Code Playgroud)

结果:

在此输入图像描述

为什么?我究竟做错了什么?

javascript inheritance prototype prototypal-inheritance

1
推荐指数
1
解决办法
60
查看次数

mysql int 11 的最大限制是多少?

读到您可以指定最大限制为int11。如果 4294967295 中只有 10 位数字,为什么会这样?

mysql

1
推荐指数
1
解决办法
979
查看次数

内部联接真实

我的桌子:

   abc
+--------+
| letter |
+--------+
| a      |
| b      |
+--------+
Run Code Online (Sandbox Code Playgroud)

查询:

SELECT *
FROM abc t1 INNER JOIN abc t2
ON true
Run Code Online (Sandbox Code Playgroud)

结果:

+--------+--------+
| letter | letter |
+--------+--------+
| a      | a      |
| b      | a      |
| a      | b      |
| b      | b      |
+--------+--------+
Run Code Online (Sandbox Code Playgroud)

做什么或怎么ON true做/工作?

mysql sql inner-join

1
推荐指数
1
解决办法
1373
查看次数

OpenSSL错误消息:错误:14090086:SSL例程:SSL3_GET_SERVER_CERTIFICATE:证书验证失败无法启用加密

我正在使用OS X Yosemite

我在Composer中运行以下命令,因为Laravel无法始终正常下载和安装:

composer diagnose

结果:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] The "https://api.github.com/rate_limit" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages: …
Run Code Online (Sandbox Code Playgroud)

ssl laravel composer-php

1
推荐指数
1
解决办法
2万
查看次数

CSS输入元素的宽度超出容器

为什么电子邮件和密码的宽度超出input-container宽度?

  form {
    background: #ccc;
  }
  .input-container {
    background: red;
    width: 469px;
    margin: 0 auto;
  }
  .usermail,
  .userpword {
    margin-top: 10px;
  }
  input,
  button {
    width: 100%;
    border-radius: 6px;
    border: 1px solid #cacece;
    padding: 10px 12px;
    font-size: 1em;
  }
  .username input {
    width: 206px;
  }
Run Code Online (Sandbox Code Playgroud)
<form action='' method='post' id='signupform'>
  <div class='input-container'>
    <div class='username'>
      <input type='text' name='fname' id='fname' placeholder='First Name'>
      <input type='text' name='lname' id='lname' placeholder='Last Name'>
    </div>
    <div class='usermail'>
      <input type='email' name='email' id='email' placeholder='Email'>
    </div>
    <div class='userpword'>
      <input type='password' …
Run Code Online (Sandbox Code Playgroud)

html css

1
推荐指数
1
解决办法
1994
查看次数

jQuery无法读取未定义的属性'toLowerCase'

我正在阅读PHP Ajax Cookbook的一章.这是代码:

HTML:

    <form class='simpleValidation'>
        <div class='fieldRow'>
            <label for='title'>Title *</label>
            <input type='text' id='title' name='title' class='required'>
        </div>
        <div class='fieldRow'>
            <label for='url'>URL</label>
            <input type='text' id='url' name='url' value='http://'>
        </div>
        <div class='fieldRow'>
            <label for='labels'>Labels</label>
            <input type='text' id='labels' name='labels'>
        </div>
        <div class='fieldRow'>
            <label for='textarea'>Text *</label>
            <textarea id='textarea' class='required'></textarea>
        </div>
        <div class='fieldRow'>
            <input type='submit' id='formSubmitter' value='Submit'>
        </div>
    </form>
Run Code Online (Sandbox Code Playgroud)

jQuery的:

$(document).ready(function() {      
        var timerId  = 0;

        $('.required').keyup(function() {
            clearTimeout(timerId);

            timerId = setTimeout(function() {
                ajaxValidation($(this));
            }, 200);
        });
    });

    var ajaxValidation = function (object) {
            var $this …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery

1
推荐指数
1
解决办法
6377
查看次数

mysqli 准备好的语句 num_rows 返回 0,而查询返回大于 0

我有一个针对实际存在的电子邮件的简单准备声明:

$mysqli = new mysqli("localhost", "root", "", "test");
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$sql = 'SELECT `email` FROM `users` WHERE `email` = ?';
$email = 'example@hotmail.com';

if ($stmt = $mysqli->prepare($sql)) {
    $stmt->bind_param('s', $email);
    $stmt->execute();

    if ($stmt->num_rows) {
        echo 'hello';
    }

    echo 'No user';
}
Run Code Online (Sandbox Code Playgroud)

结果:No user在应该回显的时候回显hello

我在控制台中运行了相同的查询,并使用与上面相同的电子邮件得到了结果。

我也使用简单的 mysqli 查询进行了测试:

if ($result = $mysqli->query("SELECT email FROM users WHERE email = 'example@hotmail.com'")) {
    echo 'hello';

}
Run Code Online (Sandbox Code Playgroud)

结果:符合我的预期hello

也是$result1 num_rows

为什么准备好的语句 …

php mysql mysqli

1
推荐指数
1
解决办法
1101
查看次数