簡體   English   中英

如何在PHP中刪除URL參數字符串的一部分

[英]How to remove a part of a URL argument string in php

為什么這不能刪除example/

$url = "http://webserver/exmaple/subdomaine/";
$domaine="example"
$domaine= $domaine."/";
echo str_replace($domaine,"",$url);

有更好的方法嗎?

謝謝!

$domaine = "example"; // Missing semicolon ...

檢查拼寫:

exmaple !== example

exmaple會是一棵過去曾經是楓樹的樹,但現在是另一種樹,例如橡樹或紫杉。

在這里犯了一個錯誤

$domaine="example"

替換為

$domaine="example";

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM