我有一個模板正在從另一個服務器調用。然後,我必須使用一些字符串替換來修復網址。ASP中explode(),str_replace()的等效
這裏是PHP代碼:
<?php
$path = $_SERVER['DOCUMENT_ROOT'];
$currentPage = $_SERVER['PHP_SELF'];
$template = file_get_contents("http://staging.domain.edu/content/libs/folder/template.html");
$template = str_replace("src=\"/etc/","src=\"https://dite.edu/etc/",$template);
$template = str_replace("href=\"/etc/","href =\"https://site.edu",$template);
$template = str_replace("src=\"/apps/","src =\"https:site.edu/",$template);
$template = str_replace("href=\"/content/","href =\"http://site.edu/content/",$template);
$template = str_replace("src=\"/content/","src=\"http://staging.domain.edu/content/",$template);
那麼我這樣做:
list($top, $bottom) = explode('INSERT CONTENT HERE', $template);`
我的問題是:我怎麼能複製這個在ASP?除了一個使用PHP之外,我們所有的服務都使用ASP。
感謝,好多問題 – LisaH
@AmalMurali尼斯編輯,怎麼樣,你以爲這當OP沒有提示它是[tag:asp.net]時,不是[tag:asp-classic]。 OP可以澄清嗎?無論哪種方式我的答案適用於兩者。 – Lankymart
@Lankymart:我在刪除'explode()'和'str-replace()'標記時意外刪除了該標籤。隨意添加它。 –