如何在不使用Web框架的情况下将所有其他页面放在基本模板中

By django, one can use a base template for a common navbar and a footer:

Firstly, adding

{% block content %}
{% endblock %}

to the base template.

Secondly, adding

{% extends 'base.html' %}
{% block content %}
{% endblock %}

to the secondary pages.

Is there a method to do this using php but without a web framework?

Yes, it's possible.

You could use a template engine like Smarty (for example, used by Prestashop) or Twig (for example used by Symphony).

If you search a little bit on Google "php template engine" you'll find some more.

Hope it helps.