本文整理汇总了PHP中Messages::sendMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::sendMsg方法的具体用法?PHP Messages::sendMsg怎么用?PHP Messages::sendMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages::sendMsg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
$msg_id = $_POST['msgID'];
$action = Messages::deleteMsg($msg_id);
if ($action === true) {
// delete success
echo json_encode(array('status' => '1', 'msgID' => $msg_id));
} else {
echo json_encode($action);
}
break;
case 'msg_send':
$data = $_POST;
unset($_POST);
if ($data['send_to'] === USER_ID) {
die(json_encode(['status' => false, 'err' => 'You can\'t send a message to yourself.']));
}
$action = Messages::sendMsg($data);
if ($action === true) {
// delete success
echo json_encode(array('status' => '1', 'msgID' => $msg_id));
} else {
echo json_encode($action);
}
break;
case 'msg_unread':
$msg_id = $_POST['msgID'];
$action = Messages::msgUnRead($msg_id);
if ($action === true) {
// delete success
echo json_encode(array('status' => '1', 'msgID' => $msg_id));
} else {
echo $action[2];
示例2: isset
<?php
require_once $_SERVER["DOCUMENT_ROOT"] . "/src/init.php";
//if (!isset($_GET['to'])) exit("404");
$user_id = isset($_GET['to']) ? sanitize_id($_GET['to']) : null;
if (USER_ID == $user_id) {
$session->message("You can't send a message to yourself.", ".");
}
if (isset($_POST['submit'])) {
if (!empty(trim($_POST['subject']))) {
$_POST['id'] = mt_rand(10000, 90000);
Messages::sendMsg();
} else {
echo "Subject cannot be empty.";
}
}
?>
<div class="ui segment">
<form class="ui form" id="msg_compose" action="#">
<div class="field">
<label>Send to</label>
<div class="ui search">
<div class="ui icon input" id="msg_sendto">
<input name="send_to" class="prompt" type="text" placeholder="Search by username or ID">
<i class="search icon"></i>
</div>
<div class="results"></div>
</div>