【发布时间】:2018-01-14 12:33:21
【问题描述】:
我正在按照本教程创建一个 cms 平台 (https://www.elated.com/articles/cms-in-an-afternoon-php-mysql/#step6)。我在 Mac 上工作,所以我已经有了 apache 和 php。我让服务器运行,但出现错误
解析错误:语法错误,第 7 行 /Users/liviarett/Documents/projects/cms-project/classes/Article.php 中的意外“类”(T_CLASS)。
所以我想我会尝试 XAMPP 看看是不是我在设置所有内容时做错了,但我得到了完全相同的错误。
有什么想法吗?回购在这里https://github.com/liviarett/cms-platform
Article.php 以
开头<?php
/**
* Class to handle articles
*/
class Article {
// Properties
/**
* @var int The article ID from the database
*/
public $id = null;
我认为代码没有任何问题,因为我从教程的说明中复制并粘贴了它。
【问题讨论】:
-
你应该给我们看看Article.php的代码。我的猜测是那里有一些语法错误。
-
Article.php第7行是什么代码?
-
刚刚编辑了问题!我不认为代码有问题: class Article { // Properties /** * @var int The article ID from the database */ public $id = null;
标签: php mysql apache content-management-system