当前位置: 首页>>代码示例>>PHP>>正文


PHP saveComment函数代码示例

本文整理汇总了PHP中saveComment函数的典型用法代码示例。如果您正苦于以下问题:PHP saveComment函数的具体用法?PHP saveComment怎么用?PHP saveComment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了saveComment函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: explode

<?php

$server_name = $_POST["server_name"];
$server_port = $_POST["server_port"];
$db_name = $_POST["db_name"];
$table_name = $_POST["table_name"];
$field_list_str = $_POST["field_str"];
include "./mongoUtil.php";
$fieldList = explode("", $field_list_str);
$tempList = array();
foreach ($fieldList as $fieldStr) {
    list($fieldName, $chineseName, $commentStr) = explode("", $fieldStr);
    array_push($tempList, array("fieldName" => $fieldName, "chineseName" => $chineseName, "commentStr" => $commentStr));
}
saveComment($server_name, $server_port, $db_name, $table_name, $tempList);
echo "保存成功!";
开发者ID:sleepyycat,项目名称:WebFramework,代码行数:16,代码来源:saveFieldComment.php

示例2: array

    }
    $condition = array(12 * 30 * 24 * 60 * 60 => 'year', 30 * 24 * 60 * 60 => 'month', 24 * 60 * 60 => 'day', 60 * 60 => 'hour', 60 => 'minute', 1 => 'second');
    foreach ($condition as $secs => $str) {
        $d = $get_time / $secs;
        if ($d >= 1) {
            $r = round($d);
            return 'about ' . $r . ' ' . $str . ($r > 1 ? 's' : '') . ' ago';
        }
    }
}
function saveComment($name, $comment, $times)
{
    $string = $name . '|' . $comment . '|' . $times;
    $file = "{$times}.comment";
    file_put_contents($file, $string);
}
saveComment('Ram', 'Awesome Program!', strtotime('04-08-2015 06:30'));
saveComment('Carom', 'Awesome Program!', strtotime('12-11-2015 04:25'));
saveComment('Edwin', 'Awesome Program!', strtotime('08-09-2015 05:50'));
function outputComment(array $comment1)
{
    printLine("Name: " . $comment1[0]);
    printLine("Comment: " . $comment1[1]);
    printLine("Time: " . $comment1[2]);
    $stars = "***********************";
    printLine($stars);
    echo "Name: " . $comment1[0] . '<br>';
    echo "comment: " . $comment1[1] . '<br>';
    echo "time: " . $comment1[2] . '<br>';
    echo "****************************<br>";
}
开发者ID:ramasubbaiya,项目名称:PHP_Term_1_Course_Work,代码行数:31,代码来源:util3.php

示例3: array_map

$_POST = array_map('strip_tags', $_POST);
$commentDate = getdate();
$errors = [];
$msg = "error";
if (isset($_POST['submit'])) {
    // Récupère les données de l'article à sauvegarder
    $commentToEdit['id_article'] = $_POST['id_article'];
    $commentToEdit['author_comment'] = $_POST['author_comment'];
    $commentToEdit['content_comment'] = $_POST['content_comment'];
    $commentToEdit['emailauthor_comment'] = $_POST['emailauthor_comment'];
    $commentToEdit['gresponse'] = $_POST['g-recaptcha-response'];
    if (isset($commentToEdit['date_comment'])) {
        $commentDate = array_reverse(array_values($commentToEdit['date_comment']));
    }
    // sauvegarde d'un article
    $errors = validComment($commentToEdit);
    //verifiyIdentity()
    if (empty($errors)) {
        $commentToEdit['date_article'] = implode("-", $commentDate);
        saveComment($commentToEdit);
        $msg = "ok";
    }
    header('Location: index.php?id=' . $commentToEdit['id_article'] . "&msg={$msg}");
    exit;
} else {
    if (isset($_GET['id']) && isset($_SESSION['id_user'])) {
        moderateComment($_GET['id'], getUserById($_SESSION['id_user']));
    }
}
header('Location: index.php');
exit;
开发者ID:HiTechRabbit,项目名称:personnal_website,代码行数:31,代码来源:comments.php

示例4: defined

* This file contains xxxxxxxxxxxxxxxxxxxxxxxxxxx.
* @version xxx
* @package RSGallery2
* @copyright (C) 2003 - 2006 RSGallery2
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* RSGallery is Free Software
*/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
require_once JPATH_RSGALLERY2_SITE . '/lib/rsgcomments/rsgcomments.class.php';
$cid = rsgInstance::getInt('cid', array(0));
$task = rsgInstance::getVar('task', '');
$option = rsgInstance::getVar('option', '');
switch ($task) {
    case 'save':
        //test( $option );
        saveComment($option);
        break;
    case 'delete':
        deleteComments($option);
        //test( $option );
        break;
}
/**
 * Test function FOR DEVELOPMENT ONLY!
 * @param string The current url option
 */
function test($option)
{
    $id = rsgInstance::getInt('id', '');
    $item_id = rsgInstance::getInt('item_id', '');
    $catid = rsgInstance::getInt('catid', '');
开发者ID:realityking,项目名称:rsgallery2,代码行数:31,代码来源:rsgcomments.php

示例5: saveComment

<?php

require_once "functions/functions.php";
//print_r(getComments('761ebc82'));
if (isset($_POST['hash'])) {
    if (isset($_POST['message'])) {
        //print_r($_POST);
        saveComment($_POST['hash'], $_POST['message']);
    }
    $comments = getComments($_POST['hash']);
    //print_r($comments);
    echo '<h2>Comments</h2>';
    foreach ($comments as $comment) {
        echo '<p class="com"><span class="small">' . $comment->date . ' &nbsp;</span>' . $comment->text . '</p>';
    }
}
?>



开发者ID:Loither,项目名称:reaktur-backend,代码行数:17,代码来源:comments.php

示例6: empty

// placeholders, which passed $s='section_name'.
$s = empty($s) ? '' : $s;
$pretext = !isset($pretext) ? array() : $pretext;
$pretext = array_merge($pretext, pretext($s, $prefs));
callback_event('pretext_end');
extract($pretext);
// Now that everything is initialised, we can crank down error reporting.
set_error_level($production_status);
if (!empty($feed) && in_array($feed, array('atom', 'rss'), true)) {
    include txpath . "/publish/{$feed}.php";
    echo $feed();
    trace_log(TEXTPATTERN_TRACE_DISPLAY);
    exit;
}
if (gps('parentid') && gps('submit')) {
    saveComment();
} elseif (gps('parentid') and $comments_mode == 1) {
    // Popup comments?
    header("Content-type: text/html; charset=utf-8");
    exit(parse_form('popup_comments'));
}
// We are dealing with a download.
if (@$s == 'file_download' && !empty($filename)) {
    output_file_download($filename);
    exit(0);
}
// Send 304 Not Modified if appropriate.
handle_lastmod();
// Log the page view.
log_hit($status);
// -------------------------------------------------------------
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:31,代码来源:publish.php

示例7: str_replace

            $currentOffset = $offsets[$i];
            $commentUrlWithOffset = str_replace("#offset", $currentOffset, $commentUrl);
            $commentsPage = getUrl($curl, $commentUrlWithOffset);
            /* Look for more pages and update offset array */
            $paging = getCommentsPages($commentsPage);
            foreach ($paging as $pageOffset) {
                if (!in_array($pageOffset, $offsets)) {
                    array_push($offsets, $pageOffset);
                    print "Got new offset for {$movieId}: {$pageOffset}. Adding to offsets\n";
                }
            }
            /* Fetch comments*/
            $comments = getComments($commentsPage, $commentUrlWithOffset);
            foreach ($comments as $comment) {
                /* Save only the comments having a declared rating */
                saveComment($fh, $id, $movieId, $commentUrlWithOffset, $comment['title'], $comment['comment'], $comment['rating'], $comment['comment-class']);
                print "Saving comment {$id} for movie {$movieId} from {$commentUrlWithOffset}\n";
                $id++;
            }
        }
    }
}
/* Cleanup */
fclose($fh);
curl_close($curl);
/****************************************************************************************
* DATA EXTRACTION
*****************************************************************************************/
function getUrl($curl, $url)
{
    curl_setopt($curl, CURLOPT_URL, $url);
开发者ID:bamatosi,项目名称:movie-reviews-classifier,代码行数:31,代码来源:imdb-comments.php

示例8: savePhoto

    $photo = '';
    if (isset($files['photo'])) {
        $photo = $files['photo'];
    }
    $result['error'] = savePhoto($uuid, $toilet_id, $photo);
    $response = $response->withHeader('Content-type', 'application/json;charset=utf-8');
    return $response->write(json_encode($result));
});
// Send comment
$app->post('/toilet-add-comment', function ($request, $response, $args) {
    $uuid = $request->getParsedBody()['uuid'];
    $toilet_id = $request->getParsedBody()['toilet_id'];
    $username = $request->getParsedBody()['username'];
    $content = $request->getParsedBody()['content'];
    $result = array();
    $result['error'] = saveComment($uuid, $toilet_id, $username, $content);
    $response = $response->withHeader('Content-type', 'application/json;charset=utf-8');
    return $response->write(json_encode($result));
});
// Get photo list for a given toilet sheet
$app->get('/toilet-photo-list/{toilet_id}', function ($request, $response, $args) {
    $toilet_id = (int) $args['toilet_id'];
    $photos = getPhotos($toilet_id);
    $res = json_encode($photos);
    $response = $response->withHeader('Content-type', 'application/json;charset=utf-8');
    return $response->write($res);
});
// Get comment list for a given toilet sheet
$app->get('/toilet-comment-list/{toilet_id}', function ($request, $response, $args) {
    $toilet_id = (int) $args['toilet_id'];
    $comments = getComments($toilet_id);
开发者ID:HandiPressante,项目名称:HandiPressante-server,代码行数:31,代码来源:api.php

示例9: saveComment

<?php

include "../universal/config.php";
//---saveComment---//
if (isset($_POST["saveComment"])) {
    include "saveComment.php";
    $result = saveComment($_POST["commentid"], $_POST["q"], $_POST["commentText"]);
    echo $result;
} elseif (isset($_POST["editComment"])) {
    include "editComment.php";
    $result = editComment($_POST["commentid"]);
    echo $result;
} elseif (isset($_POST["deleteComment"])) {
    include "deleteComment.php";
    $result = deleteComment($_POST["commentid"]);
    echo $result;
} elseif (isset($_POST["showComments"])) {
    include "showComments.php";
    $result = showComments($_POST["q"]);
    echo $result;
}
开发者ID:jamesbmayr,项目名称:project-tracker,代码行数:21,代码来源:commentsForm.php

示例10: searchList

     if (isset($_REQUEST['q'])) {
         $api_list = searchList($_REQUEST['q']);
         printServiceMsg($api_list);
     } else {
         printServiceMsg(array());
     }
     break;
 case "create-api":
     checkServiceSession();
     $status = saveApi();
     printServiceMsg($status);
     break;
 case "post-comment":
     checkServiceSession();
     if (isset($_REQUEST['api_id'])) {
         $status = saveComment();
         printServiceMsg($status);
     } else {
         printServiceMsg("error");
     }
     break;
 case "add-example":
     checkServiceSession();
     if (isset($_REQUEST['api_id']) || isset($_REQUEST['eg_id'])) {
         $example = saveExample();
         printServiceMsg($example);
     } else {
         printServiceMsg("error");
     }
     break;
 case "check-title":
开发者ID:OpenLogiks,项目名称:APIDocs,代码行数:31,代码来源:service.php

示例11: saveComment

<?php

include 'util.php';
saveComment("Rama", 'Awesome Program!', strtotime('2015/08/05 06:40:00'));
saveComment("Leo", 'Awesome Program!', strtotime('2012/12/11 07:50:00'));
saveComment("Matt", 'Awesome Program!', strtotime('2010/11/12 08:35:00'));
saveComment("Nike", 'Awesome Program!', strtotime('2012/06/05 09:25:00'));
//echo $saveComment();
$comments = loadComment();
foreach ($comments as $key => $val) {
    outputComment($val);
}
开发者ID:ramasubbaiya,项目名称:PHP_Term_1_Course_Work,代码行数:12,代码来源:comment.php


注:本文中的saveComment函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。