本文整理汇总了PHP中http::setPost方法的典型用法代码示例。如果您正苦于以下问题:PHP http::setPost方法的具体用法?PHP http::setPost怎么用?PHP http::setPost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类http
的用法示例。
在下文中一共展示了http::setPost方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateDupeTable
public static function updateDupeTable($formID, $objectID, $data)
{
// trans begin
$result = mfcs::$engine->openDB->transBegin("objects");
if ($result !== TRUE) {
errorHandle::newError(__METHOD__ . "() - unable to start database transactions", errorHandle::DEBUG);
return FALSE;
}
// wipe the old dupe information
$sql = sprintf("DELETE FROM `dupeMatching` WHERE `formID`='%s' AND `objectID`='%s'", mfcs::$engine->openDB->escape($formID), mfcs::$engine->openDB->escape($objectID));
$sqlResult = mfcs::$engine->openDB->query($sql);
if (!$sqlResult['result']) {
mfcs::$engine->openDB->transRollback();
mfcs::$engine->openDB->transEnd();
errorHandle::newError(__METHOD__ . "() - removing from duplicate table: " . $sqlResult['error'], errorHandle::DEBUG);
return FALSE;
}
//insert data
foreach ($data as $name => $raw) {
if (!isset(mfcs::$engine->cleanPost['MYSQL'][$name]) || isempty(mfcs::$engine->cleanPost['MYSQL'][$name])) {
if (!isempty($raw)) {
http::setPost($name, $raw);
$postSet = TRUE;
} else {
continue;
}
}
$sql = sprintf("INSERT INTO `dupeMatching` (`formID`,`objectID`,`field`,`value`) VALUES('%s','%s','%s','%s')", mfcs::$engine->openDB->escape($formID), mfcs::$engine->openDB->escape($objectID), mfcs::$engine->openDB->escape($name), mfcs::$engine->cleanPost['MYSQL'][$name]);
$sqlResult = mfcs::$engine->openDB->query($sql);
if (isset($postSet) && $postSet === TRUE) {
http::setPost($name, "");
}
if (!$sqlResult['result']) {
mfcs::$engine->openDB->transRollback();
mfcs::$engine->openDB->transEnd();
errorHandle::newError(__METHOD__ . "() - : " . $sqlResult['error'], errorHandle::DEBUG);
return FALSE;
}
}
// trans commit
mfcs::$engine->openDB->transCommit();
mfcs::$engine->openDB->transEnd();
return TRUE;
}
示例2: add
public static function add($formID, $metadata, $objectID = NULL)
{
if (!is_array($metadata)) {
errorHandle::newError(__METHOD__ . "() - : metedata is not array", errorHandle::DEBUG);
return FALSE;
}
if (!self::validID(FALSE, $objectID)) {
errorHandle::newError(__METHOD__ . "() - : invalid objectID provided", errorHandle::DEBUG);
return FALSE;
}
// populate cleanPost
foreach ($metadata as $I => $V) {
http::setPost($I, $V);
}
// submit to forms::submit
return forms::submit($formID, $objectID, TRUE);
}
示例3: foreach
include "../public_html/includes/functions.php";
include "../public_html/includes/validator.php";
$objects = objects::get();
// Begin the transaction
if (mfcs::$engine->openDB->transBegin("objects") !== TRUE) {
print __METHOD__ . "() - unable to start database transactions";
exit;
}
foreach ($objects as $object) {
// only rebuild the objects
if ($object['metadata'] != '0') {
continue;
}
// Build cleanPost
// @TODO this should be stripped when updateDupeTable is fixed to not require cleanPost
// Reset cleanPost
mfcs::$engine->cleanPost['MYSQL'] = array();
mfcs::$engine->cleanPost['HTML'] = array();
mfcs::$engine->cleanPost['RAW'] = array();
foreach ($object['data'] as $name => $raw) {
http::setPost($name, $raw);
}
if (duplicates::updateDupeTable($object['formID'], $object['ID'], $object['data']) === FALSE) {
mfcs::$engine->openDB->transRollback();
mfcs::$engine->openDB->transEnd();
print __METHOD__ . "() - updating dupe matching";
exit;
}
}
mfcs::$engine->openDB->transCommit();
mfcs::$engine->openDB->transEnd();