本文整理汇总了PHP中Messages::saveUserMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::saveUserMessage方法的具体用法?PHP Messages::saveUserMessage怎么用?PHP Messages::saveUserMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages::saveUserMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// + STEP 2: get data +
// +-----------------------------------+
$token = $_REQUEST['access_token'];
$other_id = $_REQUEST['user2'];
$message = $_REQUEST['message'];
if (!($token && $other_id && $message)) {
$success = "0";
$msg = "Incomplete Parameters";
$data = array();
} else {
// +-----------------------------------+
// + STEP 3: perform operations +
// +-----------------------------------+
$user_id = GeneralFunctions::getUserId($token);
if ($user_id) {
$data = Messages::saveUserMessage($user_id, $other_id, $message);
if ($data) {
$success = "1";
$msg = "Message Sent";
}
} else {
$success = "0";
$msg = "Token Expired";
}
}
// +-----------------------------------+
// + STEP 4: send json data +
// +-----------------------------------+
/*if($success==1){
echo json_encode(array("success"=>$success,"msg"=>$msg,"message"=>$message));
}
示例2: randomFileNameGenerator
$randomFileName = randomFileNameGenerator("Img_") . "." . end(explode(".", $image['name']));
if (@move_uploaded_file($image['tmp_name'], "../uploads/{$randomFileName}")) {
$image_name = $randomFileName;
}
} else {
$image_name = "";
}
if ($video) {
$randomFileName1 = randomFileNameGenerator("Img_") . "." . end(explode(".", $video['name']));
if (@move_uploaded_file($video['tmp_name'], "../uploads/{$randomFileName1}")) {
$video_name = $randomFileName1;
}
} else {
$video_name = "";
}
$data = Messages::saveUserMessage($user_id, $other_id, $message, $image_name, $video_name, $message_type);
if ($data) {
$success = "1";
$msg = "Message Sent";
$messages = Messages::getRecUserMessagesAfter($user_id, $other_id, $message_id);
$data = $messages ? $messages : [];
//push check
$push_check = GeneralFunctions::PushCheck($other_id);
$push_notif = $push_check[0]['push_notification'];
if ($push_notif) {
//push notification code
$user = GeneralFunctions::get_push_ids($other_id);
$apnid = $user[0]['apn_id'];
$oid = $user[0]['id'];
$reg_ids[] = $user[0]['reg_id'];
$message = array();