{"id":764,"date":"2014-10-07T10:20:01","date_gmt":"2014-10-07T02:20:01","guid":{"rendered":"http:\/\/blog.turn.tw\/?page_id=764"},"modified":"2014-10-08T18:22:08","modified_gmt":"2014-10-08T10:22:08","slug":"%e8%b5%b7%e9%bb%9e%ef%bc%9apublicindex-php","status":"publish","type":"page","link":"https:\/\/blog.turn.tw\/?page_id=764","title":{"rendered":"\u8d77\u9ede\uff1apublic\/index.php"},"content":{"rendered":"<p>Laravel\u6846\u67b6\u7684\u5165\u53e3\u6a94\u6848\uff0c\u6240\u6709PHP\u6846\u67b6\u90fd\u6709\u9019\u6a23\u4e00\u652f\u6a94\u6848\u3002<br \/>\n\u6ce8\u610findex.php\u6a94\u4e0d\u5728\u6839\u76ee\u9304\uff0c\u800c\u662f\u5728public\u8cc7\u6599\u593e\u88cf\u9762\u3002Apache\u8abf\u6574\u8def\u5f91\u7684.htaccess\u4e5f\u5728\u90a3\u5152\u3002<br \/>\n\u56e0\u6b64\uff0cweb server\u7684\u6839\u76ee\u9304\u4e0d\u6703\u8a2d\u6210Laravel\u7684\u6839\u76ee\u9304\uff0c\u800c\u662fpublic\u8cc7\u6599\u593e\u3002<br \/>\n\u9019\u9ebc\u505a\u662f\u56e0\u70ba\u8cc7\u5b89\u8003\u91cf\uff1apublic\u5167\u901a\u5e38\u9084\u6703\u653e\u500bassets\u8cc7\u6599\u593e(\u64fa\u653ecss\/js\/img\u7b49\u6a94\u6848)\u4e4b\u985e\u7684\u3001\u53ea\u5141\u8a31public\u8cc7\u6599\u593e\u88ab\u4f7f\u7528\u8005\u63a5\u89f8\u5230\u3001\u8b93\u5176\u4ed6\u5730\u65b9\u7684\u6a94\u6848\u4e0d\u6703\u88ab\u60e1\u610f\u4f7f\u7528\u8005\u78b0\u5230\u3002<br \/>\n\u8209CodeIgniter2.1.4\u7248\u672c\u70ba\u53cd\u4f8b\uff1aindex.php\u653e\u5728\u6839\u76ee\u9304\uff0c\u5c0e\u81f4\u6240\u6709\u8cc7\u6599\u593e\u90fd\u6709\u53ef\u80fd\u88ab\u4f7f\u7528\u8005\u63a5\u89f8\u5230\u3002\u7d50\u679c\u53ea\u597d\u5728\u6240\u6709\u6a94\u6848\u524d\u9762\u52a0\u4e0a\uff1a<\/p>\n<pre><?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');\r\n<\/pre>\n<p>\u7136\u5f8c\u5728\u6bcf\u500b\u8cc7\u6599\u593e\u5efa\u7acbindex.html\u6a94\uff1a<\/p>\n<pre>\r\n<html>\r\n<head>\r\n\t<title>403 Forbidden<\/title>\r\n<\/head>\r\n<body>\r\n\r\n<p>Directory access is forbidden.<\/p>\r\n\r\n<\/body>\r\n<\/html>\r\n<\/pre>\n<p>\u4f5c\u70ba\u9632\u79a6\u4e86\uff0c\u633a\u7169\u7684\u3002<\/p>\n<pre>\r\n<?php\r\n\/**\r\n * Laravel - A PHP Framework For Web Artisans\r\n *\r\n * @package  Laravel\r\n * @author   Taylor Otwell <taylorotwell@gmail.com>\r\n *\/\r\n\r\n\/*\r\n|--------------------------------------------------------------------------\r\n| Register The Auto Loader\r\n|--------------------------------------------------------------------------\r\n|\r\n| Composer provides a convenient, automatically generated class loader\r\n| for our application. We just need to utilize it! We'll require it\r\n| into the script here so that we do not have to worry about the\r\n| loading of any our classes \"manually\". Feels great to relax.\r\n|\r\n*\/\r\n\r\nrequire __DIR__.'\/..\/bootstrap\/autoload.php';\r\n<\/pre>\n<p>\u8f09\u5165\u4e00\u500b\u6703\u81ea\u52d5\u8f09\u5165\u6240\u9700\u985e\u5225\u7684php\u6a94\uff0c\u8b93\u958b\u767c\u4eba\u54e1\u4e0d\u9700\u8981\u624b\u52d5\u8f09\u5165\u4ed6\u5011\u3002<br \/>\n\u53c3\u898b\uff1a<a href=\"https:\/\/blog.turn.tw\/?page_id=768\">\u81ea\u52d5\u8f09\u5165\u985e\u5225\uff1abootstrap\/autoload.php<\/a><\/p>\n<pre>\r\n\/*\r\n|--------------------------------------------------------------------------\r\n| Turn On The Lights\r\n|--------------------------------------------------------------------------\r\n|\r\n| We need to illuminate PHP development, so let's turn on the lights.\r\n| This bootstraps the framework and gets it ready for use, then it\r\n| will load up this application so that we can run it and send\r\n| the responses back to the browser and delight these users.\r\n|\r\n*\/\r\n\r\n$app = require_once __DIR__.'\/..\/bootstrap\/start.php';\r\n<\/pre>\n<p>\u8f09\u5165\u6846\u67b6\u672c\u8eab\u3002<\/p>\n<pre>\r\n\/*\r\n|--------------------------------------------------------------------------\r\n| Run The Application\r\n|--------------------------------------------------------------------------\r\n|\r\n| Once we have the application, we can simply call the run method,\r\n| which will execute the request and send the response back to\r\n| the client's browser allowing them to enjoy the creative\r\n| and wonderful application we have whipped up for them.\r\n|\r\n*\/\r\n\r\n$app->run();\r\n<\/pre>\n<p>\u547c\u53ebrun\u51fd\u5f0f\uff0c\u63a5\u6536request\u3001\u8655\u7406\uff0c\u6700\u5f8c\u9001\u51fa\u76f8\u61c9\u7684response\u56de\u53bb\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Laravel\u6846\u67b6\u7684\u5165\u53e3\u6a94\u6848\uff0c\u6240\u6709PHP\u6846\u67b6\u90fd\u6709\u9019\u6a23\u4e00\u652f\u6a94\u6848\u3002 \u6ce8\u610findex.php\u6a94\u4e0d\u5728\u6839\u76ee\u9304\uff0c\u800c\u662f\u5728pu &hellip; <a href=\"https:\/\/blog.turn.tw\/?page_id=764\" class=\"more-link\">\u7e7c\u7e8c\u95b1\u8b80 <span class=\"screen-reader-text\">\u8d77\u9ede\uff1apublic\/index.php<\/span> <span class=\"meta-nav\">&rarr;<\/span> <\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"open","template":"","meta":{"_mi_skip_tracking":false},"_links":{"self":[{"href":"https:\/\/blog.turn.tw\/index.php?rest_route=\/wp\/v2\/pages\/764"}],"collection":[{"href":"https:\/\/blog.turn.tw\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.turn.tw\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.turn.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.turn.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=764"}],"version-history":[{"count":8,"href":"https:\/\/blog.turn.tw\/index.php?rest_route=\/wp\/v2\/pages\/764\/revisions"}],"predecessor-version":[{"id":853,"href":"https:\/\/blog.turn.tw\/index.php?rest_route=\/wp\/v2\/pages\/764\/revisions\/853"}],"wp:attachment":[{"href":"https:\/\/blog.turn.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}