pathname

    -1熱度

    1回答

    比方說,我有一個虛擬網站的網址:http://company.com/something。 我需要抓住路徑:/東西,並使用開關大小寫重定向到一個新的URL使用JavaScript。 有人能指導我嗎? var URL; var url_param = location.pathname; switch(url_param) { case "/how-to-do-this":

    3熱度

    1回答

    我認爲我的問題將需要一些背景解釋。我的任務是創建一個基本服務器,它將根據客戶端請求在我的系統上發送HTML文件。我被告知通過在我的Firefox瀏覽器中輸入localhost:8080/index.html作爲測試客戶端來測試我的服務器。輸入該行輸入正確並打印出index.html的內容。作爲一種安全措施,我被要求進行測試以確保所請求的文件在我目前正在工作的範圍內,如果不是,我會拒絕該請求。我已經

    0熱度

    1回答

    我必須使用正則表達式從URL獲取主機名&路徑名。 URL可在 一個)http://test.com/mary/archive/project.aspx形式 - >我想http::/test.com/mary b)中http://www.testmary.com/company - >我想http://www.testmary.com/ c)中http://marytest.com/b/about/

    5熱度

    1回答

    我試圖使用來從URL當前文件名: $currentFile = window.location.pathname.split("/").pop(); 此工作正常,如果完整路徑是一樣的東西: http://www.yoursite.com/folder/index.php 將返回的index.php,index.cfm,index.html的等 但是當網址http://www.yoursit

    3熱度

    2回答

    我目前使用下面的代碼來定位具體網頁,如http://my-website.com/about/ if (document.location.pathname == "/about/") { //Code goes here } 我想知道如何爲有一定的父頁等所有頁面做同樣的如/about/在以下實施例.. http://my-website.com/about/child-

    1熱度

    1回答

    我在我的主目錄.phpsh和.php_history有兩個文件,並使用它們的名字我想測試路徑名的擴展以及它如何影響bash中的關聯數組。我遇到的結果似乎很奇怪,我不能解釋它們。我在這裏嘗試了一大堆變化。 >my_array_filename_var=(".phpsh"=10 ".php_history" =20) >echo ${my_array_filename_var[.phpsh]} E

    10熱度

    1回答

    有什麼區別我們知道根目錄是/,根據posix,還有另一個不同於/的目錄。當你ls /和ls //時,輸出與stat相同,但是如果你是cd /和cd //,它們是不同的,儘管目錄內容是相同的。 這讓我很困惑。任何人都有答案?

    0熱度

    2回答

    我想打印每一個文件的路徑名及其子文件夾的文件夾 這是代碼在我到目前爲止: def traverse(path, d): for item in os.listdir(path): item = os.path.join(path, d) try: traverse(path,d) except: print(path)

    0熱度

    2回答

    我正在改進去年編寫的script listing duplicated files(如果您點擊鏈接,請參閱第二個腳本)。 duplicated.log輸出的記錄分隔符是零字節,而不是回車\n。例如: $> tr '\0' '\n' < duplicated.log 12 dir1/index.htm 12 dir2/index.htm 12 dir3/in

    0熱度

    2回答

    是否有一些本地函數(shell,linux命令)合併/計算完整路徑? 例如: old_path="~/test1/test2/../dir3//file.txt" new_path=FUN($old_path) echo "$new_path" // I want get this "/home/user/test1/dir3/file.txt"