cakephp bake生成

bake生成是cakephp快速建站的工具

配置环境变量 把php的php.exe设置到环境变量中,PATH D:/php就是php的根目录而不是ext下面,配置完后就可以在cmd命令行中执行php文件了,

进入到cakephp项目中的app目录下面,执行php ../cake/console/cake.php bake 这样就出出来一个界面,里面显示了你要进行生成的 M V C P Q 等基本信息,生成的时候先生成model,在生成的过程中只要表里面建有一定的关系,那么不管先生成哪个表,都会生成对应的关系,其中可能会提示你是否要更改表的别名等信息,提示很明了可以按提示来做。

代码规范与态度问题。 /**

	 * 删除一条信息
	 * @param  int $id 信息id
	 * @return 
	 */
	function delete($id) {
		$this->Post->id = $id;
		$this->Post->saveField('is_deleted',1);
		$this->Session->setFlash('帖子编号为:'.$id.'已被删除.');
		$this->redirect(array('action' => 'index'));
	}
	
	/**
	 * 编辑信息
	 * @param int $id 信息id
	 * @return 
	 */
	function edit($id = null) {
		$this->Post->id = $id;
		if (empty($this->data) || $this->data['Post']['title'] == '' || $this->data['Post']['body'] == '') {
			$this->data = $this->Post->read();
			$this->Session->setFlash('数据不完整.');
			$this->set('arrone',$this->data);
		} else {
			if ($this->Post->save($this->data)) {
				$this->Session->setFlash('你以编辑了此记录.');
				$this->redirect(array('action' => 'index'));
			}
		}
	}
 

你可能感兴趣的:(C++,c,PHP,ext,cakephp)