我在我的开源项目中使用jQuery 1.5,以下行也出现在我自己的Javascript代码中:
/**
* Object.isEmpty()
*
* @returns {Boolean}
*/
Object.prototype.isEmpty = function ()
{
/**
* @deprecated Since Javascript 1.8.5
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object
*/
if ( this.__count__ !== undefined )
{
return this.__count__ === 0 ? true : false;
}
/* Less-aesthetic method, if above method fails */
for ( var property in this )
{
if ( this.hasOwnProperty(property) )
{
return false;
}
}
return true;
};
Run Code Online (Sandbox Code Playgroud)
它只是扩展了Object.prototype,为它添加了isEmpty()方法[检查对象是否为空).由于这个添加,我的Firebug控制台中出现"c.replace is not function"错误; 我在网上的研究引导我去jQuery bug跟踪器消息,在那里我"学会"扩展Object.prototype不仅打破了jQuery,而且还是糟糕的编码实践.我的问题是,为什么?
代码如下,我的目标是使用Pdo_mysql:
use \Zend\Db\Adapter\Adapter;
use \Zend\Db\Sql\Sql;
use \Zend\Db\Sql\Expression;
$params = array(
'driver' => "Pdo_mysql",
'host' => &$this->Registry->config[ 'sql' ][ 'host' ],
'username' => &$this->Registry->config[ 'sql' ][ 'user' ],
'password' => &$this->Registry->config[ 'sql' ][ 'passwd' ],
'dbname' => &$this->Registry->config[ 'sql' ][ 'dbname' ]
);
$this->adapter = new \Zend\Db\Adapter\Adapter( $params );
$this->platform = $this->adapter->getPlatform();
$this->sql = new Sql( $this->adapter );
Run Code Online (Sandbox Code Playgroud)
当我检查标识符引用符号时:
print $this->platform->getQuoteIdentifierSymbol(); // Output: "
Run Code Online (Sandbox Code Playgroud)
如您所见,双引号是符号.这当然无效矿井所有的MySQL查询,因为它用双引号("),而不是前引号(')引用的所有标识符名称(表,列等).
那么,为什么PDO-MySQL驱动程序使用Sql92符号呢?以及如何解决这个问题?
问题:在以下HTML标记中:
<html>
<body>
<div id="div_1"></div>
<div id="div_2"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我希望两者div(可以是任何其他标签)居中并排放在一起.如何使用CSS实现这一点,而无需添加第三个父容器?
我的开源项目工作正常,直到我在休息6个月后开始工作.更新到最新的XAMPP,并开始收到大量奇怪的错误,其中一个是:
我有Input类,调用方法如下:
<?php
class Input
{
public function __call ( $name , $arguments )
{
if ( !in_array( $name, array( "post", "get", "cookie", "request", "server", "env" ) ) )
{
throw new Exception( "Input::" . $name . "() not declared!" );
}
$_name_of_superglobal = "_" . strtoupper( $name );
$_max_iteration_level_for_cleanup = in_array( $name, array( "server", "env" ) ) ? 1 : 10;
# $arguments[0] is the index of the value, to be fetched from within the array.
if …Run Code Online (Sandbox Code Playgroud)