本文整理汇总了PHP中util::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP util::quote方法的具体用法?PHP util::quote怎么用?PHP util::quote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util
的用法示例。
在下文中一共展示了util::quote方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quote
public static function quote($input, $convert = true)
{
if ($convert == true) {
$input = util::convert($input);
}
if (is_array($input)) {
foreach ($input as $k => $v) {
$input[$k] = util::quote($v, $convert);
}
} else {
$input = "'{$input}'";
}
return $input;
}
示例2: get
}
//检查是否在客户端是否是内网ip
//isPrivateIp($_SERVER['REMOTE_ADDR']) || exit('forbbidden');
include_once '../include/config.php';
$dsnName = get($_GET, 'dsn', 'db');
$table = get($_GET, 'table');
$db = pool::db($dsnName);
if ('generate' == get($_GET, 'act')) {
/** 生成校验函数内字符串 */
foreach ($db->query('show full COLUMNS from ' . $table) as $row) {
$type = strpos($row['Type'], '(') !== false ? substr($row['Type'], 0, strpos($row['Type'], '(')) : $row['Type'];
$emptyV = $row['Default'] != null ? "'" . $row['Default'] . "'" : (in_array($type, array('tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'decimal', 'float', 'double', 'enum')) ? 'null' : "''");
$checkData .= sprintf("\r\n\t\tcase '%s':\r\n\t\t\t\$arr[\$k]=empty(\$v)?%s:\$v;\r\n\t\tbreak;", $row['Field'], $emptyV);
}
// 生成基本类
$fields = implode(',', util::quote(array_keys($_POST['field'])));
$ds_table = str_replace('_', '/', $table);
$mod = SYS_PATH . 'include/' . $ds_table . '.php';
$str = file_get_contents(SYS_PATH . 'tools/code/include.php');
$str = str_replace(array('__dsnName__', '__table__', '__ds_table__', '__fields__', '__checkData__'), array($dsnName, $table, $ds_table, $fields, $checkData), $str, $checkData);
file::save($mod, $str);
//生成表管理类
$mod = SYS_PATH . 'controller/' . $ds_table . '.php';
$str = file_get_contents(SYS_PATH . 'tools/code/modules.php');
$str = str_replace(array('__table__', '__ds_table__'), array($table, $ds_table), $str);
file::save($mod, $str);
//模板处理
$option = '';
foreach ($_POST['search'] as $key => $val) {
$name = $_POST['field'][$key];
$option .= sprintf('<option value="%s">%s</option>' . "\n", $key, $name);
示例3: str_replace
<?php
// Altera o titulo
$_SESSION['eload']['title'] = "Cusulta de pedidos - {sitename}";
// carrega o ID da Transação
$pedido = JRequest::getvar('pedido', false);
// remove os '-'
$id = str_replace('-', '', $pedido);
// carrega o e-mail
$email = JRequest::getvar('email', false);
// proteção sql injection
jimport('edesktop.util');
$id2 = util::quote($id);
$email2 = util::quote($email);
// carrega a class
jimport('edesktop.programas.loja.pedidos');
// inicia o obj
$p = new edesktop_loja_pedidos();
// busca os dados
$dados = $p->busca_por_transacaoID($id2, $email2);
// verifica a consulta
$msg = false;
if ($email && !$dados) {
$msg = true;
}
// envia os dados
$this->assignRef('msg', $msg);
$this->assignRef('dados', $dados);
$this->assignRef('pedido', $pedido);
$this->assignRef('email', $email);