Cainiao asks php to open the path and ask for advice. during the practice of leaving a message, & lt; form & nbsp; action2.php & nbsp; methodpost & gt ;.... & lt; input & nbsp; typesubmit & nbsp; value submission & gt; after submission, the page jumps to file: D: wampwwwtest_html2.php. I 'd like to ask you how to solve the php Open path problem.
Ask for advice,
....
After submission, the page jumps to file: // D:/wamp/www/test_html/2.php.
I would like to ask how to change the webpage to localhost/test_html/2.php
When you use the notepad ++ shortcut key, it will also be the file path name. how can you change it to localhost?
------ Solution ----------------------
If you use sublime, modify it as follows:
Sublime Text 2
Sublime Text 3 can be used:
Menu --> Tools --> New Pugin
# Clear the content and add the following code
Import sublime, sublime_plugin
Import webbrowser
Url_map = {
'E: \ phpStudy \ WWW ': 'http: // localhost ',
}
Class OpenBrowserCommand (sublime_plugin.TextCommand ):
Def run (self, edit ):
Window = sublime. active_window ()
Window. run_command ('save ')
Url = self. view. file_name ()
Flag = False
For path, domain in url_map.items ():
If url. startswith (path ):
Url = url. replace (path, domain). replace ('\\','/')
Flag = True
Break
If not flag:
Url = 'File: // '+ url
Webbrowser. open_new (url)
Then save the file. the save path is similar to the following:
C: \ Users \ XXXX \ AppData \ Roaming \ Sublime Text 3 \ Packages \ User \ open_browser.py
XXXX is a Windows 7 system user. you can find this directory through the Sublime menu.
Menu --> Preferences --> Browse Packages click to open the Directory
Note:
E: \ phpStudy \ WWW replace it with the path of the root directory of your Web document
Bind a shortcut key
Menu --> Preferences --> Key Bindings-User
Add the following code:
[{"Keys": ["ctrl + B"], "command": "open_browser"}]