Skip to content

carlclone/framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

framework

运行

//单入口模式 symfony server:start --port=4321 --passthru=front.php

测试

./vendor/bin/phpunit

覆盖率测试,需要开启 xdebug

./vendor/bin/phpunit --coverage-html=cov/ ./vendor/bin/phpunit --coverage-text

avatar

草稿

https://symfony.com/doc/current/create_framework/unit_testing.html

安装 symfony https://symfony.com/download

curl -sS https://get.symfony.com/cli/installer | bash

symfony server:start

//Request 类的使用

// the URI being requested (e.g. /about) minus any query parameters
$request->getPathInfo();

// retrieve GET and POST variables respectively
$request->query->get('foo');
$request->request->get('bar', 'default value if bar does not exist');

// retrieve SERVER variables
$request->server->get('HTTP_HOST');

// retrieves an instance of UploadedFile identified by foo
$request->files->get('foo');

// retrieve a COOKIE value
$request->cookies->get('PHPSESSID');

// retrieve an HTTP request header, with normalized, lowercase keys
$request->headers->get('host');
$request->headers->get('content-type');

$request->getMethod();    // GET, POST, PUT, DELETE, HEAD
$request->getLanguages(); // an array of languages the client accepts

$request = Request::create('/index.php?name=Fabien');

$response = new Response();

$response->setContent('Hello world!');
$response->setStatusCode(200);
$response->headers->set('Content-Type', 'text/html');

// configure the HTTP cache headers
$response->setMaxAge(10);

About

build a framework with symfony

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages