将 PHP 后端合并到一个文件中,用于 Axios GET React

Combine PHP backend into one file for Axios GET React

我正在使用 React 前端并将其连接到 PHP 和 Axios 以通过 cURL 获取数据。目前我在 React 中获得的 Axios 很少,文件也很少。我可以将PHP个文件合并成一个文件,然后将它们分开放在同一个文件中,然后使用React分别获取数据吗?

This is my frontend or react code

My backend which is similar to the other php files but different api.

我想将 cURL 合并到一个文件中,然后通过函数或 Axios 可以单独调用的东西将它们分开。可能吗?

通过在 php 文件中使用 (isset($_GET['memory'])) 和在反应前端中使用 axios.post('http://localhost/react-backend/index2.php?memory') 找到解决方案