In learning the Ajax part of the Javascript,jquery, has not understood how to do, do not know how to do the server, what do not know, at the time of learning Ajax, in addition to look at the Ajax content, practice very little, because, do not know how to do. Now, how to practice Ajax, how to achieve front-end interaction, I choose the apache+php+mysql here. And, I installed the various versions are a long time version, choose this is because the installation process is relatively simple, but relatively simple, although early, but for the general test is enough.build Apache + Php+mysql platformThis is my local form of a folder, in addition to Workspace is created by themselves, the rest are extracted files1: Preparation of resourcesphp DownloadTo the official website, direct Baidu PHP, into the official website (here PHP Apache recommended to download the official website, in addition to slow, the rest to Nothing) right corner, click on a version, go to find Windows downloads, click into the bottom right corner of the page to findArchives, click to enter a page like this:after that, download the . Msi,.zip file you need todownload to a file, unzip it, if the file name is too long, can be modified, as simple as possibleThis is what I downloaded: When downloading, be aware thatPHP and Apache versions to match(V9-v9, V11-v11, ..., x86-x86, x64-x64)Download ApacheSimilarly, the official website enters the download interface to find archive download site. Click to enter to find the followingbinaries(binary file) Click to enter to findwin, at the bottom of the list, click to go to Win32, under this page, select your own. msiVersions are available for these several downloadable preparation files,try to keep it in the same directory, on the same levelThis is the one I downloaded:MySQLDownload the process of the speed of their own experience ... Directly find Baidu, download, but, if you can, or to download the official website (here Navicat for MySQL has cracked patches, there is a need, can find their own) after the decompression of the decompression so that all the software ready OK!2: Configure the EnvironmentThis is the version I downloaded, a long time ago, I was the latest version of the download, but, configuration for a long time, are not successful simply before the next, the configuration is successful! Then, double-click, install this process, there are many processes on the Web, you can self-view will form a file, there is a Apache2.2 and a index.html file, I directly put these two files out, and PHP files on the same layer created a workspace, workspace After that, configure several files: Open by Path (this path is not necessarily the same for everyone) Here are two files, the last two,php.ini is not, directly copy the Php.ini-development, then, modify to Pnp.ini, you canThen, open the two files separately, as far as possible with the appropriate to open the software, it will be better to modify such as:notepad++(This software is used here, it is more convenient)ctrl+f: For searching, this is a more practical and convenient operation------------------------------------------------------------------------------------------------------- --------------------------
httpd.conf
#加上这些, if it is, comment it out (try to freeze it) ServerRoot"d:/wapm/apache2.2"Listen the#LoadModule vhost_alias_module Modules/mod_vhost_alias.so# After this sentence add LoadModule php5_module"D:\wapm\php5.3.10\php5apache2_2.dll"Phpinidir"D:\wapm\php5.3.10"AddType Application/x-httpd-php. php. html. htm# the location of any file in your extracted php file servername localhost: theDocumentRoot"D:/wapm/workspace"#这个是刚才创建的workspace, then you can put the contents of the original position under this workspace<directory"D:/wapm/workspace">#这下面这几行上面的这个<directory ... >Modify to the above, #not change # # Possible values forThe Options directive are"None"," All", # or any combination of: # Indexes includes followsymlinks symlinksifownermatch execcgi multiviews<directory/>Options followsymlinks allowoverride None Order deny,allow deny from All</Directory> <ifmodule dir_module>directoryindex index.php index.html</IfModule>
--------------------------------------------------------------------------------------------------------------- -----php.ini
; On Windows:;the following sentenceExtension_dir = "D:\wapm\php5.3.10\ext"; In the extracted PHP file has ext such a file; extension=php_soap.dll;extension=php_sockets.dll;extension=php_sqlite.dll;extension=php_sqlite3.dll;extension=php_sybase_ct.dll;extension=php_tidy.dll;extension=php_xmlrpc.dll;extension=php_xsl.dll;extension=php_zip.dll; found in the above, the following sentences, modify, or remove the preceding semicolon, or directly below add these words extension=php_mysqli.DLL Extension=php_curl.DLL Extension=php_gd2.DLL Extension=php_mbstring.DLL Extension=php_mysql.DLL Extension=php_xmlrpc.dll; Also, find and modify TimeZone(Modify area time)
Date. TimeZone = Asia/shanghai
--------------------------------------------------------------------------------------------------------------- -------------
Almost, my two files have done the above processing. Next, find a double-click, or, right-click, open it can be opened if no error, the description OK. After Apache is installed locally, I let it turn on automatically as soon as it is powered on. (To determine that the configuration file is not configured complete/correct), install MySQL, and navicat for mysql,ok! Specific installation, can be self-search check:enter localhost in the browser URL input boxOk! Environment to build success!3:ajax+php Test:Create a new file Ajax under Workspace, create a. html. php file under Ajax files here, the direct use of jquery Ajax, for simple testing, you can steal a little lazy ajax_php_test.html:
<!DOCTYPE HTML><HTML><Head> <MetaCharSet= "Utf-8" /> <title>ajax+php Test</title> <Scripttype= "Text/javascript"src= "Jquery-3.2.1.js"></Script></Head><Body> <Div>The data obtained:</Div> <inputID= "Load"type= "button"value= "Get data from the background" /> <DivID= "Data"></Div><Scripttype= "Text/javascript"> $("#load"). Bind ("Click",function(){ var $ This=$( This); $("#data"). HTML ('Loading in progress! '). Load ("test.php",function(){ $ This. attr ("Disabled", "true"); }); });</Script></Body></HTML>
test.php:
<? PHP Header ("Content-type:text/plain;charset=utf-8"); echo " This is the data from the server! ";? >
Double-click the. html file, open from the browser, after clicking the button: you will find no data to PHP files because this is not an HTTP application, but the file local files service in the URL to make the following changes, after clicking the button: OK, the correct access to the contents of the PHP file! Note: This icon is an integrated environment that I have previously installed without care. In this way, the environment is set up, and the front-end interaction can be done.
ajax+php (Environment construction + test)