如何在 Hostinger 上部署自定义 PHP MVC 网站
这是我第一次部署实际的网站,并且使用自定义 MVC 架构完成了一个项目。在本地一切正常,但是当我将文件添加到 Hostinger 时,除了空白页面之外什么也没有出现。不过,图标和 CSS 仍然加载在 中。我的层次结构如下所示:
config
- index.php
public
- assets
- .htaccess
- index.php
- logout.php
src
- model
- view
- controller
templates
- (list of all the things I render with my views)
在位于 config 文件夹中的 index.php 中,我拥有所有常量。看起来是这样的:
<?php
// HOST
define("HOST", "https://heptagone-art.com/public/");
// DIR
define("DIR_ASSETS", HOST . "assets/");
define("DIR_CSS", DIR_ASSETS . "css/main.css");
define("DIR_JS", DIR_ASSETS . "js/");
define('DIR_APPLICATION', '../src/');
define('DIR_MODEL', DIR_APPLICATION . 'model/');
define('DIR_VIEW', DIR_APPLICATION . 'view/');
define('DIR_CONTROLLER', DIR_APPLICATION . 'controller/');
define('DIR_TEMPLATE', '../templates/');
// DB
define("DB_HOSTNAME", "localhost");
define("DB_USERNAME", "(the username hostinger gave me");
define("DB_PASSWORD", "(the password I added on hostinger)");
define("DB_DATABASE", "(the database I added on hostinger");
define("DB_PORT", "3306");
我真的不知道如何正确部署整个事情,而且我不知道如何搜索它,因为我找到的信息与我所做的不匹配。
This is the first time I'm deploying an actual website and I did a project using a custom MVC architecture. Everything is working just fine on local but when I add my files to Hostinger, nothing appears but a blank page. The favicon and the CSS is still loaded in the , though. My hierarchy looks like that:
config
- index.php
public
- assets
- .htaccess
- index.php
- logout.php
src
- model
- view
- controller
templates
- (list of all the things I render with my views)
In the index.php located in the config folder, I have all my constants. It looks like that :
<?php
// HOST
define("HOST", "https://heptagone-art.com/public/");
// DIR
define("DIR_ASSETS", HOST . "assets/");
define("DIR_CSS", DIR_ASSETS . "css/main.css");
define("DIR_JS", DIR_ASSETS . "js/");
define('DIR_APPLICATION', '../src/');
define('DIR_MODEL', DIR_APPLICATION . 'model/');
define('DIR_VIEW', DIR_APPLICATION . 'view/');
define('DIR_CONTROLLER', DIR_APPLICATION . 'controller/');
define('DIR_TEMPLATE', '../templates/');
// DB
define("DB_HOSTNAME", "localhost");
define("DB_USERNAME", "(the username hostinger gave me");
define("DB_PASSWORD", "(the password I added on hostinger)");
define("DB_DATABASE", "(the database I added on hostinger");
define("DB_PORT", "3306");
I don't really know how to deploy the whole thing properly, and I don't know how to search about it as the information I find don't match with what I did.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论