38.103.161.160/forum/index.php,index.php

/**

* Step 1: Require the Slim Framework

*

* If you are not using Composer, you need to require the

* Slim Framework and register its PSR-0 autoloader.

*

* If you are using Composer, you can skip this step.

*/

require 'Slim/Slim.php';

\Slim\Slim::registerAutoloader();

/**

* Step 2: Instantiate a Slim application

*

* This example instantiates a Slim application using

* its default settings. However, you will usually configure

* your Slim application now by passing an associative array

* of setting names and values into the application constructor.

*/

$app = new \Slim\Slim();

/**

* Step 3: Define the Slim application routes

*

* Here we define several Slim application routes that respond

* to appropriate HTTP request methods. In this example, the second

* argument for `Slim::get`, `Slim::post`, `Slim::put`, `Slim::patch`, and `Slim::delete`

* is an anonymous function.

*/

// GET route

$app->get(

'/',

function () {

$template = <<

Slim Framework for PHP 5

html,body,div,span,object,iframe,

h1,h2,h3,h4,h5,h6,p,blockquote,pre,

abbr,address,cite,code,

del,dfn,em,img,ins,kbd,q,samp,

small,strong,sub,sup,var,

b,i,

dl,dt,dd,ol,ul,li,

fieldset,form,label,legend,

table,caption,tbody,tfoot,thead,tr,th,td,

article,aside,canvas,details,figcaption,figure,

footer,header,hgroup,menu,nav,section,summary,

time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;}

body{line-height:1;}

article,aside,details,figcaption,figure,

footer,header,hgroup,menu,nav,section{display:block;}

nav ul{list-style:none;}

blockquote,q{quotes:none;}

blockquote:before,blockquote:after,

q:before,q:after{content:'';content:none;}

a{margin:0;padding:0;font-size:100%;vertical-align:baseline;background:transparent;}

ins{background-color:#ff9;color:#000;text-decoration:none;}

mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold;}

del{text-decoration:line-through;}

abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help;}

table{border-collapse:collapse;border-spacing:0;}

hr{display:block;height:1px;border:0;border-top:1px solid #cccccc;margin:1em 0;padding:0;}

input,select{vertical-align:middle;}

html{ background: #EDEDED; height: 100%; }

body{background:#FFF;margin:0 auto;min-height:100%;padding:0 30px;width:440px;color:#666;font:14px/23px Arial,Verdana,sans-serif;}

h1,h2,h3,p,ul,ol,form,section{margin:0 0 20px 0;}

h1{color:#333;font-size:20px;}

h2,h3{color:#333;font-size:14px;}

h3{margin:0;font-size:12px;font-weight:bold;}

ul,ol{list-style-position:inside;color:#999;}

ul{list-style-type:square;}

code,kbd{background:#EEE;border:1px solid #DDD;border:1px solid #DDD;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;padding:0 4px;color:#666;font-size:12px;}

pre{background:#EEE;border:1px solid #DDD;border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;padding:5px 10px;color:#666;font-size:12px;}

pre code{background:transparent;border:none;padding:0;}

a{color:#70a23e;}

header{padding: 30px 0;text-align:center;}

Slim

Welcome to Slim!

Congratulations! Your Slim application is running. If this is

your first time using Slim, start with this "Hello World" Tutorial.

Get Started

  1. The application code is in index.php
  2. Read the online documentation
  3. Follow @slimphp on Twitter

Slim Framework Community

Support Forum and Knowledge Base

Visit the Slim support forum and knowledge base

to read announcements, chat with fellow Slim users, ask questions, help others, or show off your cool

Slim Framework apps.

Twitter

Follow @slimphp on Twitter to receive the very latest news

and updates about the framework.

Slim Framework Extras

Custom View classes for Smarty, Twig, Mustache, and other template

frameworks are available online in a separate repository.

Browse the Extras Repository

EOT;

echo $template;

}

);

// POST route

$app->post(

'/post',

function () {

echo 'This is a POST route';

}

);

// PUT route

$app->put(

'/put',

function () {

echo 'This is a PUT route';

}

);

// PATCH route

$app->patch('/patch', function () {

echo 'This is a PATCH route';

});

// DELETE route

$app->delete(

'/delete',

function () {

echo 'This is a DELETE route';

}

);

/**

* Step 4: Run the Slim application

*

* This method should be called last. This executes the Slim application

* and returns the HTTP response to the HTTP client.

*/

$app->run();

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值