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


PHP DAOFactory::getMessagesDAO方法代码示例

本文整理汇总了PHP中DAOFactory::getMessagesDAO方法的典型用法代码示例。如果您正苦于以下问题:PHP DAOFactory::getMessagesDAO方法的具体用法?PHP DAOFactory::getMessagesDAO怎么用?PHP DAOFactory::getMessagesDAO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DAOFactory的用法示例。


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

示例1:

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/priv_dao/include_dao.php';
// $ip = '' ;
// if( !empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
// $ip = $_SERVER['HTTP_CLIENT_IP'] ;
// } else if ( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
// $ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ;
// } else {
// $ip = $_SERVER['REMOTE_ADDR'] ;
// }
// date_default_timezone_set( 'ASIA/SHANGHAI' ) ;
// $time = date( 'Y-m-d H:i:s ' , time( ) ) ;
// print $ip.' -- ip<br/>' ;
// print $time.' -- time<br/>' ;
// $transaction = new Transaction();
// $message = new Message( ) ;
// $message->time = $time ;
// $message->ip = $ip ;
// $message->content = 'test' ;
// DAOFactory::getMessagesDAO()->insert($message);
// $transaction->commit();
$messages = DAOFactory::getMessagesDAO()->queryAllOrderBy('time');
// foreach( $messages as $message ) {
// print $message->time." ".$message->ip." ".$message->content."<br/>" ;
// }
开发者ID:amaranth0203,项目名称:Sources,代码行数:26,代码来源:handler.php

示例2: date_default_timezone_set

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/priv_dao/include_dao.php';
$ip = '';
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
    $ip = $_SERVER['HTTP_CLIENT_IP'];
} else {
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
}
date_default_timezone_set('ASIA/SHANGHAI');
$time = date('Y-m-d H:i:s ', time());
$transaction = new Transaction();
$message = new Message();
$message->time = $time;
$message->ip = $ip;
$message->content = $_POST['message'];
DAOFactory::getMessagesDAO()->insert($message);
$transaction->commit();
开发者ID:amaranth0203,项目名称:Sources,代码行数:22,代码来源:leave_message.php

示例3: array_reverse

<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/priv_dao/include_dao.php';
$messages = array_reverse(DAOFactory::getMessagesDAO()->queryAllOrderBy('time'));
开发者ID:amaranth0203,项目名称:Sources,代码行数:4,代码来源:get_messages.php


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