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.pswp.cn/news/279011.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/279011.shtml
英文地址,請注明出處:http://en.pswp.cn/news/279011.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

oracle11g導入錯誤,oracle 11g導入到10g引起的錯誤

環境介紹老環境新環境操作系統&#xff1a;redhat5.8 64位redhat6.4 64位數據庫版本&#xff1a;oracle 10.2.0.4 64位oracle 11.2.0.4 64位背景&#xff1a;之前有一套老的數據庫rac是基于oracle10g搭建&#xff0c;跑了幾年了。現在前端應用程序準備升級&#xff0c;考慮到前…

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…

TextInput

TextInput /** TextInput 是一個允許用戶在應用中通過鍵盤輸入文本的基本組件* 本組件的屬性提供了多種特性的配置,如自動完成,自動大小寫,占位文字,鍵盤類型等* 常用:* placeholder 占位符* value 輸入框的值* password 是否密文輸入* editable 是否可編輯* retureKeyType …

如何使用oracle查詢,oracle 表查詢

Oracle 的 oracle 表查詢通過scott用戶下的表來演示如何使用select語句&#xff0c;接下來對emp、dept、salgrade表結構進行解說。emp 雇員表字段名稱 數據類型 是否為空 備注-------- ----------- -------- --------EMPNO NUMBER(4) 員工編…

火狐標簽在中間_在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中打開了大量內容繁重的網頁&…

[CQOI2012]模擬工廠 題解(搜索+貪心)

[CQOI2012]模擬工廠 題解(搜索貪心) 標簽&#xff1a;題解 閱讀體驗&#xff1a;https://zybuluo.com/Junlier/note/1327574 鏈接題目地址&#xff1a;洛谷P3161 BZOJ P2667 這個題練一練綜合思想還是不錯的。。。&#xff08;然而蒟蒻不會啊&#xff09; 做法 肯定是在能完成某…

上傳文件的input問題以及FormData特性

1.input中除了type"file"還要加上name"file"&#xff0c;否則$_FILES為空&#xff0c;input的name值就是為了區分每一個input的 2.var formdata new FormData($("#form")[0]); 或者var formdata new FormData(document.getElementById("f…

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…

oracle中spool卸數,數據卸載--spool的使用

&#xfeff;&#xfeff;引言在項目中&#xff0c;我們經常會遇到數據的卸載、裝載需求。卸載就是需要將數據從數據庫中導入到文本文件中的需求&#xff0c;這樣的方法有很多&#xff0c;比較常用的就是spool命令。裝載就是需要將數據從文本文件中導入到數據庫中。方法也有很多…

Objective-C中的@property

1.property是什么 Property是聲明屬性的語法&#xff0c;它可以快速方便的為實例變量創建存取器&#xff0c;并允許我們通過點語法使用存取器。 存取器&#xff08;accessor&#xff09;&#xff1a;指用于獲取和設置實例變量的方法。用于獲取實例變量值的存取器是getter&#…

Linux基礎命令---findfs

findfs 查找指定卷標或者UUID的文件系統對應的設備文件。findfs將搜索系統中的磁盤&#xff0c;尋找具有標簽匹配標簽或與UUID相等的文件系統。如果找到文件系統&#xff0c;文件系統的設備名稱將打印在stdout上。 此命令的適用范圍&#xff1a;RedHat、RHEL、Ubuntu、CentOS、…

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…

mysql記錄

當沒有用EXISTS引入子查詢時&#xff0c;在選擇列表中只能指定一個表達式轉載于:https://www.cnblogs.com/niuben/p/9920741.html