本文整理汇总了PHP中Chat::getNome方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::getNome方法的具体用法?PHP Chat::getNome怎么用?PHP Chat::getNome使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::getNome方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
<?php
//Limeza do cookie setcookie('nome', '',time()-3600*24);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$nome = trim(filter_input(INPUT_POST, 'nome'));
if (empty($nome)) {
$erro = 'Nome é Obrigatório';
} else {
require "config/config.php";
$chat = new Chat();
$chat->setNome($nome);
if ($chat->existeNome()) {
$erro = 'Já existe alguém usando esse nome';
} else {
setcookie('nome', $chat->getNome(), time() + 3600 * 24 * TEMPO_LIMITE);
header('location:chat-index.php');
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Entrando no Sistema</title>
<!--BOOTSTRAP-->
<link href="js/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
示例2: Chat
<?php
require "config/config.php";
$chat = new Chat();
switch ($_POST['acao']) {
case 'inserir':
$chat->excluir();
$chat->setNome($_COOKIE['nome']);
$chat->setMensagem(filter_input(INPUT_POST, 'mensagem'));
if ($chat->inserir()) {
printf('<p class="bg-primary eu pull-right">[%s] - %s</p><br>', $chat->getNome(), $chat->getMensagem());
}
break;
case 'atualizar':
foreach ($chat->listar() as $v) {
$ativo = $v['nome'] == $_COOKIE['nome'] ? 'class="bg-primary eu pull-right"' : 'class="bg-warning ele pull-right;"';
printf('<br><p %s> %s Disse: " %s "</p><br>', $ativo, $v['nome'], $v['mensagem']);
}
break;
}