Angular 2 CLI - 用于索引文件的 php 而不是 html 文件

问题描述:

有没有办法将通过 Angular 2 CLI 创建和提供的 Angular 2 应用程序从默认的 html 文件更改为 php 文件?有没有设置某个地方用 ng serve 命令确定作为默认索引文件?

Is there a way to change an Angular 2 application that is created and served via Angular 2 CLI from the default html file to a php file? Is there a setting someplace that determines with the ng serve command serves up as the default index file?

MBU

似乎 angular cli 不允许您将默认文件名设置为与 index.html 不同的名称.

It seems that angular cli does not allow you to set default file name to something different than index.html.

即使可以更改 index.php,您也不会完成您想要的.要运行 php 文件,您需要 PHP 解释器.ng serve 中没有这样的东西,因为它的主要目的是提供静态 HTML 文件.

Even if the change to index.php would be possible, you will not accomplish what you want. To run php files, you need PHP interpreter. There is no such thing in ng serve, as it's main purpose is to serve static HTML files.