成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

php記錄

tainzhi / 1412人閱讀

摘要:獲取執(zhí)行的語句天前月前周前二進(jìn)制安全簡單說就是傳入的參數(shù)支持二進(jìn)制數(shù)據(jù),包括這種在中表示字符串結(jié)束的字符返回由于是非二進(jìn)制安全,誤判為相等返回負(fù)數(shù)捕捉異常中斷腳本執(zhí)行是否完成異

獲取php pdo 執(zhí)行的sql語句
class MyPDOStatement extends PDOStatement
{
  protected $_debugValues = null;

  protected function __construct()
  {
    // need this empty construct()!
  }

  public function execute($values=array())
  {
    $this->_debugValues = $values;
    try {
      $t = parent::execute($values);
      // maybe do some logging here?
    } catch (PDOException $e) {
      // maybe do some logging here?
      throw $e;
    }

    return $t;
  }

  public function _debugQuery($replaced=true)
  {
    $q = $this->queryString;

    if (!$replaced) {
      return $q;
    }

    return preg_replace_callback("/:([0-9a-z_]+)/i", array($this, "_debugReplace"), $q);
  }

  protected function _debugReplace($m)
  {
    $v = $this->_debugValues[$m[1]];
    if ($v === null) {
      return "NULL";
    }
    if (!is_numeric($v)) {
      $v = str_replace(""", """", $v);
    }

    return """. $v .""";
  }
}

// have a look at http://www.php.net/manual/en/pdo.constants.php
$options = array(
  PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
  PDO::ATTR_STATEMENT_CLASS => array("MyPDOStatement", array()),
);

// create PDO with custom PDOStatement class
$pdo = new PDO($dsn, $username, $password, $options);

// prepare a query
$query = $pdo->prepare("INSERT INTO mytable (column1, column2, column3)
  VALUES (:col1, :col2, :col3)");

// execute the prepared statement
$query->execute(array(
  "col1" => "hello world",
  "col2" => 47.11,
  "col3" => null,
));

// output the query and the query with values inserted
//http://stackoverflow.com/questions/7716785/get-last-executed-query-in-php-pdo
var_dump( $query->queryString, $query->_debugQuery() );
laravel Carbon
composer require nesbot/carbon
use CarbonCarbon;
CarbonCarbon::setLocale("zh");
echo Carbon::now()->toDateTimeString();
echo Carbon::parse("2016-10-15")->toDateTimeString();
Carbon::parse("+3 days")->toDateTimeString(); 
echo Carbon::parse("next wednesday")->toDateTimeString();
echo Carbon::now()->modify("+15 days");
$first = Carbon::create(2012, 9, 5, 23, 26, 11);

$second = Carbon::create(2012, 9, 5, 20, 26, 11, "America/Vancouver");
var_dump($first->gt($second));                     // bool(false)
var_dump(Carbon::create(2012, 9, 5, 3)->between($first, $second));          // bool(true)

$dt = Carbon::now();
$dt->isWeekday();
echo Carbon::now()->subDays(5)->diffForHumans();               // 5天前

echo $dt->diffForHumans($dt->copy()->addMonth());              // 1月前
echo Carbon::now()->subDays(24)->diffForHumans();              // 3周前
PHP 二進(jìn)制安全
//簡單說就是傳入的參數(shù)支持二進(jìn)制數(shù)據(jù),包括”