by Example
显示下拉菜单
Configuration of PDO::setAttribute()
本页面仅提供英文版本。
<?php
/**
* PHP By Example
*
* @copyright 2015 Michel Corne
* @license http://www.opensource.org/licenses/gpl-3.0.html GNU GPL v3
*/
require_once 'models/function_core.php';
/**
* Function configuration
*
* @see docs/function-configuration.txt
*/
class pdo__setattribute extends function_core
{
public $constant_prefix = [
'attribute' => 'PDO::ATTR',
'value' => 'PDO::',
];
public $examples = [
['PDO::ATTR_CASE', 'PDO::CASE_LOWER'],
['PDO::ATTR_CASE', 'PDO::ATTR_CURSOR'],
];
public $source_code = '
$pdo = new PDO("sqlite::memory:", null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
inject_function_call
// shows the attribute
if ($bool) {
$mixed = $pdo->getAttribute($attribute);
}
';
public $synopsis = 'public bool PDO::setAttribute ( int $attribute , mixed $value )';
function post_exec_function()
{
if ($this->result['bool']) {
$attribute = $this->_filter->filter_arg_value('attribute');
$this->result['mixed'] = $this->object->getAttribute($attribute);
}
}
function pre_exec_function()
{
$this->result['pdo'] = $this->object = new PDO('sqlite::memory:', null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
}
}
帮助
杂项
配置
测试
单元测试
Powered by
PHP 7.1.33 (0.02 s)
2014-2017 Michel Corne