I believe everyone is familiar with svn. When you first come into contact with the company's projects, you may find that their svn has the function of automatically synchronizing to the official website.
Isn’t it amazing?
The following takes the svn server installed under Windows as an example to teach you a few lines of code to implement this function.
Usually We use VisualSVN server-side software for the svn server, and the free tortoise svn software for svn locally.
post-commit is in the hooks directory of SVN.
post-commit.bat code is as follows:
@echo off SET REPOS=%1 SET REV=%2 SET SVN="C:/Program Files/VisualSVN Server/bin/svn.exe" SET DIR=%REPOS%/hooks SET PATH=%PATH%; SVN update F:/wroot123/ --username ww --password ww rem "F:/wroot123/"目录必须先checkout
There are many such tutorials on Baidu, but because they are too complicated, I don’t want to learn them after just reading them. This article is Simplified version, hope it helps you.
To learn PHP, go to the PHP Chinese website.
This article is edited by php Chinese website,
Article address: http://www.php.cn/php-weizijiaocheng-374260.html
Please do not reprint~~ ~~
The above is the detailed content of svn automatically synchronizes the project code to the website root directory to achieve instant updates. For more information, please follow other related articles on the PHP Chinese website!