php 自带 web server 如何重写 rewrite .htaccess

为什么80%的码农都做不了架构师?>>>   hot3.png

<?php
// filename: route.php
if (preg_match('/\.(?:png|jpg|jpeg|gif|css|js)$/', $_SERVER["REQUEST_URI"])) {return false;
} else {include __DIR__ . '/index.php';
}

更好的写法:

<?php
// route.php
$filename = __DIR__.preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);
if (is_file($filename)) {return false;
} else {include __DIR__ . '/index.php';
}

命令行执行:

php -S localhost:8888 route.php

 

转载于:https://my.oschina.net/sskill/blog/1584540

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/279011.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

sci-hub谷歌插件_Google Home Hub具有隐藏屏幕设置菜单

sci-hub谷歌插件You can adjust the brightness or set an alarm on your Google Home Hub with a voice command. But if you’re trying to be quiet or there’s a lot of background noise, you can also do these things using a hidden Screen Settings menu. 您可以使用…

二叉树的前序、中序、后序遍历与创建

#include <iostream> #include <string> #include <stack> using namespace std; struct node; typedef node *pNode; struct node { char data; pNode left, right; }; string line; string::iterator it; // 前序扩展序列建立二叉树 void plan…

flex-2

1、 2、 justify&#xff1a;整理版面 3、 4、归纳 justify-content&#xff1a;flex-start&#xff08;默认&#xff09;、center、flex-end 下面还会提到剩下的两种项目在主轴上对齐方式&#xff1a; space-between:两端对齐&#xff08;项目间距离相等&#xff09; space-ar…

火狐标签在中间_在Firefox中保留未使用的标签

火狐标签在中间If you have a lot of content heavy webpages open in Firefox, it soon adds up on memory usage. The BarTab extension puts unused tabs on hold and keeps them unloaded until you are ready to access them. 如果您在Firefox中打开了大量内容繁重的网页&…

iphone手机备忘录迁移_如何在iPhone和iPad上使用语音备忘录

iphone手机备忘录迁移Whether you’re recording a voice message as a reminder of that million dollar idea or catching a snippet of a new song you know you’ll forget, the iPhone and iPad’s Voice Memos app is the perfect tool. 无论您是录制语音消息来提醒这一百…

php 执行文件tar打包,利用tar for windows对大量文件进行快速打包

近期将某些网站换服务器&#xff0c;由于网站数量巨大&#xff0c;加上附件和静态页&#xff0c;文件数量异常多&#xff0c;考虑先打包然后直接传过去。起初尝试用winrar打包&#xff0c;但是发现即使选择”仅储存”速度仍然慢到无法接受&#xff0c;后来想到了tar&#xff0c…

DDD~领域事件中使用分布式事务

对于一个聚合来说&#xff0c;它可能会被附加很多事件&#xff0c;这里我们叫它领域事务&#xff0c;因为一个聚会我们可以把它理解成一个领域&#xff0c;一个业务。对于领域事件不清楚的同学可以看看我的这篇文章《DDD~领域事件与事件总线》&#xff0c;里面有详细的说明&…

如何在PowerPoint中制作打字机或命令行动画

Adding quirky animations to your Microsoft PowerPoint presentation gives your slideshow a little extra life. Not only will adding a typewriter or command line animation entertain your audience, but it will also keep them focused on the text. 在您的Microsof…

canvas 平滑运动_什么是电视上的运动平滑?人们为什么讨厌它?

canvas 平滑运动Willy Barton/Shutterstock.com威利巴顿/Shutterstock.comIf you’ve just bought a new TV, you might be wondering why everything you watch feels eerily sped up and smooth, like you’re watching a live broadcast all the time. You’re not imaginin…

linux guard什么进程,使用linux系统性能监控工具KSysguard监控远端主机介绍

KDE System Guard默认的窗口前端图形界面使用传感器(sensors)获得要显示的信息。传感器返回的可以是一个简单的数值或更复杂的信息如表格。针对不同的信息类型都提供了一个或多个显示界面。这些显示界面被组织在多个工作表中&#xff0c;工作表可以独立存储和加载。KSysguard主…

macbook充电_如何判断MacBook是否正在充电

macbook充电2p2play / Shutterstock2p2play / ShutterstockForgetting to charge your MacBook properly overnight can leave you with a headache in the morning. And if you’re troubleshooting a broken MacBook, checking if it’s able to charge is one way to rule o…

chrome同步_如何在Chrome中打开或关闭同步

chrome同步Google Chrome lets you sync up your Google account to your browser across any device. When enabled, bookmarks, history, passwords, extensions, and themes—among many other settings—sync from your Google account, creating a seamless experience no…

linux系统输入指令,详解linux系统输入输出管理和vim的常用功能

####系统中输入输出的管理####1.理解系统的输入输出重定向输入重定向是指把文件导入到命令中&#xff0c;而输出重定向则是把原本要输出到屏幕的数据信息写入到指定文件中。2.管理输入输出的符号##输出重定向> ##重定向正确输2> ##重定向错误输出&> …

Deep Learning(深度学习)学习笔记整理(二)

本文整理了网上几位大牛的博客&#xff0c;详细地讲解了CNN的基础结构与核心思想&#xff0c;欢迎交流 [1]Deep learning简介 [2]Deep Learning训练过程 [3]Deep Learning模型之&#xff1a;CNN卷积神经网络推导和实现 [4]Deep Learning模型之&#xff1a;CNN的反向求导及练习 …

百度新闻 谷歌新闻_每日新闻摘要:到目前为止,Google I / O提供的最佳信息

百度新闻 谷歌新闻Google’s yearly developer conference started yesterday, and the keynote was chock-full of announcements, demos, and some utterly mind-blowing tech. From Assistant to Android, here’s some of the best stuff to come out of I/O 2019 so far. …

word2016 语法检查_如何改进Microsoft Word的语法检查器

word2016 语法检查Microsoft Word comes with a powerful grammar checker, but many of its advanced grammar detection features are disabled by default. Grammarly is popular, but you don’t need it to add grammar checking to Word. Word itself contains a free al…

linux服务器硬件监控,Linux服务器实时监控加载硬件信息

Linux服务器监控之实时监控加载硬件信息Linux负有盛名的特点之一是其非凡的稳定性。然而&#xff0c;如果您的硬件有缺陷或配置不正确&#xff0c;即使是世界上最稳定的操作系统也不会对您有什么帮助。计算机系统是由软件系统硬件系统组成的&#xff0c;检测硬件状态对于保障整…

Using Python with Oracle

2019独角兽企业重金招聘Python工程师标准>>> Using Python with Oracle This page discusses using Python with Oracle. The page is based on the cx_oracle Python extension module. It was developed on a VM running Oracle Enterprise Linux 6U4 runnng Orac…

小米oj 反向位整数(简单位运算)

反向位整数 序号&#xff1a;#30难度&#xff1a;一般时间限制&#xff1a;1000ms内存限制&#xff1a;10M 描述 输入32位无符号整数&#xff0c;输出它的反向位。 例&#xff0c;输入4626149&#xff08;以二进制表示为00000000010001101001011011100101&#xff09;&#xff…

如何在Microsoft Word中插入签名

Adding your signature to a Microsoft Word document is the ultimate way to personalize it as your own, especially for documents like letters or contracts. If you want to add a signature to a Word document, here’s how. 将签名添加到Microsoft Word文档是将其个…