<?php
namespace Dp\DriveplusBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Dp\DriveplusBundle\Entity\Messageboard;
class MessageController extends Controller
{
public function indexAction()
{
$em = $this->getDoctrine()->getEntityManager();
$query = $em->createQuery(
'SELECT m FROM DpDriveplusBundle:Messageboard m ORDER BY m.id DESC'
);
$comments = $query->getResult();
$count = count($comments);
return $this->render('DpDriveplusBundle:Message:index.html.twig', array('comments'=>$comments, 'count'=>$count));
}
public function ajaxAction()
{
$request = $this->getRequest();
$ret = '';
if ('POST' === $request->getMethod()) {
$name = $request->get('name');
$message = $request->get('message');
$ret = '姓名:'.$name.'<br/> 留言内容:'.$message.'<hr/>';
$comment = new Messageboard();
$comment->setName($name);
$comment->setMessage($message);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($comment);
$em->flush();
return new Response($ret);
}
}
}
一、源码特点采用典型的三层架构进行开发,包含购物车、登陆注册、个人中心、留言板、新闻系统,前台页面、后台管理等二、功能介绍本源码是一个三层购物网站源码,功能齐全,界面美观简洁,非常适合二次开发和学习,欢迎下载三、菜单功能前台页面1、注册2、登陆3、首页4、购物车5、会员中心6、收藏家7、客服中心8、留言板后台管理1、管理员系统:管理员列表;管理员添加2、会员管理系统:会员列表3、新闻系统:新闻列表
0
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号