adi73434 / php-test-router-please-ignore
我编写了一个测试路由器,因为市面上有太多这样的路由器,我只是想进行实验。这是一个简单的路由器,它将解决我在使用纯PHP创建API时遇到的问题。
dev-main
2021-10-12 12:09 UTC
Requires
- php: >=7.4.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2024-09-25 02:16:25 UTC
README
我目前正在为/与/围绕NGINX构建这个项目,配置文件非常硬编码,感觉很不舒服。
location /php-router {
# Yes, I am hosting it in WSL; I'm yet to build a homelab which will also
# function as a dev server. This requires money, and a good job gives money :)
alias "/mnt/d/Productivity NVMe/__Git/_PHP/php-test-router-please-ignore";
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
# This was a default check within snippets to check the PHP file exists
# before passing it... well, 99% of requests won't exist as files, because
# they're not
#try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
#set $path_info $fastcgi_path_info;
#fastcgi_param PATH_INFO $path_info;
#fastcgi_index index.php;
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root/src/index.php;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}