本文整理汇总了PHP中H::Format方法的典型用法代码示例。如果您正苦于以下问题:PHP H::Format方法的具体用法?PHP H::Format怎么用?PHP H::Format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类H
的用法示例。
在下文中一共展示了H::Format方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Mail
public static function Mail($to, $subject = '(No subject)', $message = '', $from = '')
{
$header = "MIME-Version: 1.0\n";
$header .= "Content-type: text/html; charset=utf-8 \n";
$header .= "Content-Transfer-Encoding: 8bit\n";
$header .= H::Format("From: {0}\n", $from);
mail($to, $subject, $message, $header, H::Format("-f {0}", $from));
}
示例2: BuildUpdate
private function BuildUpdate($table, $values, $conditions)
{
$query = "UPDATE {PREFIX}{TABLE} SET {VALS} WHERE {CONDS}";
$valuesString = "";
$conditionsString = "";
$values_bits = [];
$conditions_bits = [];
foreach ($values as $key => $value) {
$valueStr = $value;
if (is_string($value)) {
$valueStr = "'" . $this->Escape($value) . "'";
}
$values_bits[] = H::Format("{0} = {1}", $key, $valueStr);
}
foreach ($conditions as $condition) {
if (is_array($condition)) {
$targetStr = $condition["TARGET"];
if (is_string($targetStr)) {
$targetStr = "'" . $this->Escape($targetStr) . "'";
}
$conditions_bits[] = H::Format("{0} {1} {2}", $condition["KEY"], $condition["COMPARISON"], $targetStr);
} else {
$conditions_bits[] = $condition;
}
}
$valuesString = implode(", ", array_values($values_bits));
$conditionsString = implode(" ", array_values($conditions_bits));
$query = H::FormatArr($query, ["PREFIX" => DBPREFIX, "TABLE" => $table, "VALS" => $valuesString, "CONDS" => $conditionsString]);
return $query;
}