本文整理汇总了PHP中messages::create方法的典型用法代码示例。如果您正苦于以下问题:PHP messages::create方法的具体用法?PHP messages::create怎么用?PHP messages::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages
的用法示例。
在下文中一共展示了messages::create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
$to2 = explode("\n", $to1[1]);
$to = str_replace('>', '', str_replace('<', '', $to2[0]));
$to = explode(" ", $to);
foreach ($to as $toField) {
if (filter_var($toField, FILTER_VALIDATE_EMAIL)) {
$to = $toField;
break;
}
}
$message1 = explode("\n\n", $email);
$start = count($message1) - 3;
if ($start < 1) {
$start = 1;
}
//Parse "message"
$message2 = explode("\n\n", $message1[$start]);
$message = $message2[0];
//Parse "from"
$from1 = explode("\nFrom: ", $email);
$from2 = explode("\n", $from1[1]);
if (strpos($from2[0], '<') !== false) {
$from3 = explode('<', $from2[0]);
$from4 = explode('>', $from3[1]);
$from = $from4[0];
} else {
$from = $from2[0];
}
//$email = str_replace("\n", "<br />", $email);
//$email = str_replace("\r", "<br />", $email);
$messages->create($to, $from, $subject, $email);
示例2: array
$messageText = preg_replace('/\\s+/', ' ', $messageText);
//replace all white spaces to one space
$messageText = helper::escapeText($messageText);
$messageImg = helper::clearText($messageImg);
$messageImg = helper::escapeText($messageImg);
$result = array("error" => true, "error_code" => ERROR_UNKNOWN);
$auth = new auth($dbo);
if (!$auth->authorize($accountId, $accessToken)) {
api::printError(ERROR_ACCESS_TOKEN, "Error authorization.");
}
$profile = new profile($dbo, $profileId);
$profile->setRequestFrom($accountId);
$profileInfo = $profile->get();
if ($profileInfo['state'] != ACCOUNT_STATE_ENABLED) {
echo json_encode($result);
exit;
}
if ($profileInfo['allowMessages'] == 0 && $profileInfo['follower'] === false) {
echo json_encode($result);
exit;
}
$blacklist = new blacklist($dbo);
$blacklist->setRequestFrom($profileId);
if (!$blacklist->isExists($accountId)) {
$messages = new messages($dbo);
$messages->setRequestFrom($accountId);
$result = $messages->create($profileId, $chatId, $messageText, $messageImg);
}
echo json_encode($result);
exit;
}