Start developing a simple PHP for Git Server Chapter ____php

Source: Internet
Author: User

The cause and the cause, here no longer tell, directly into the subject of project development, I would like to dedicate to the small partner who likes to study GIT

Project structure:

+ router.php//Routing files
+ app.php//Application files
+ git.php//git operation core files
+ index.php//Entry files

Next, you'll start with a flashback to the GIT server, and first, look at the index.php

$router = new Router;
$app = new app;


$app->gitroot = ' D:\Code\git-demo '//Set git warehouse directory for server-side storage of git warehouse

/get repo info/refs
$router->any ([' Get ', ' head '], '/*\.git/info/refs ', [$app, ' getinforefs ']);

$router->post ('/*\.git/git-[a-z]+-pack ', [$app, ' Command ']);

Access file Contents
$router->any ([' Get ', ' head '], '/*\.git/* ', function () {return false;});

$router->post ('/create ', function () {
    echo git::init (' Mine ');
});


$router->run ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.