新页面未在浏览器中呈现

时间:2018-03-29 19:03:18

标签: php laravel

我是laravel的新手,

我的主页是https://localhost/laravel/,它正确路由到

Route::get('/', function () {
    return view('welcome');
});

我还创建了一个新的html页面'about' 路由

Route::get('about', function () {
    return view('about');
});

但是https://localhost/laravel/about给出了404错误。

我的HTAcess文件是

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>
    Options +FollowSymLinks
    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]
     AllowOverride All
    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

2 个答案:

答案 0 :(得分:0)

你的&#34;关于&#34;页面必须是&#34; welcome&#34;页面存在,应该有一个&#34; about.blade.php&#34;名称。

如果&#34; laravel&#34;是根目录(包含&#34; App&#34;,&#34; bootstrap&#34;,&#34; config&#34; ...目录)然后about页面必须位于资源&gt; views目录中。

答案 1 :(得分:0)

您应该在#include <SPI.h> #include <MFRC522.h> #include "SoftwareSerial.h" #include <Wire.h> #include <LiquidCrystal_I2C.h> //I2C pins declaration LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); #define SS_PIN 9 #define RST_PIN 7 #define mainLock 2 String ssid = "MYSSID"; String password = "PASSWORD"; SoftwareSerial esp(2, 3);// RX, TX String server = "192.168.1.102"; //Your Host String uri = "/get_data.php?rfid_key="; //#define LED_G 4 //define green LED pin //#define LED_R 5 //define red LED #define BUZZER 6 //buzzer pin MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance. String rfidUid = ""; #define DEBUG true void setup() { // Serial.begin(9600); // Initiate a serial communication esp.begin(9600); Serial.begin(9600); SPI.begin(); // Initiate SPI bus mfrc522.PCD_Init(); // Initiate MFRC522 connectWifi(); httpget(); delay(1000); Serial.println("Put your card to the reader..."); Serial.println(); pinMode(mainLock, OUTPUT); lcd.begin(16, 2); //Defining 16 columns and 2 rows of lcd display lcd.backlight();//To Power ON the back light } void connectWifi() { sendData("AT+RST\r\n", 2000, DEBUG); //This command will reset module to default sendData("AT+CWMODE=3\r\n", 1000, DEBUG); String cmd = "AT+CWJAP=\"" + ssid + "\",\"" + password + "\""; esp.println(cmd); delay(4000); if (esp.find("OK")) { Serial.println("Connected!"); } else { Serial.println("Cannot connect to wifi ! Connecting again..."); connectWifi(); } } /////////////////////////////GET METHOD/////////////////////////////// void httpget() { // // Look for new cards if ( ! mfrc522.PICC_IsNewCardPresent()) { return; } // Select one of the cards if ( ! mfrc522.PICC_ReadCardSerial()) { return; } //Show UID on serial monitor Serial.print("UID tag :"); String content = ""; byte letter; rfidUid = ""; for (byte i = 0; i < mfrc522.uid.size; i++) { Serial.print(mfrc522.uid.uidByte < 0x10 ? " 0" : " "); Serial.print(mfrc522.uid.uidByte, HEX); content.concat(String(mfrc522.uid.uidByte < 0x10 ? " 0" : " ")); content.concat(String(mfrc522.uid.uidByte, HEX)); rfidUid += String(mfrc522.uid.uidByte < 0x10 ? "0" : ""); rfidUid += String(mfrc522.uid.uidByte, HEX); } Serial.println(); content.toUpperCase(); lcd.clear(); lcd.setCursor(0, 0); lcd.print(rfidUid); esp.println("AT+CIPSTART=\"TCP\",\"" + server + "\",80");//start a TCP connection. if ( esp.find("OK")) { Serial.println("TCP connection ready"); } delay(1000); if ( esp.find("OK")) { Serial.println("TCP connection ready"); } delay(1000); String getRequest = "GET " + uri + rfidUid + " HTTP/1.0\r\n" + "Host: " + server + "\r\n" + "Accept: *" + "/" + "*\r\n" + "Content-Type: text/plain\r\n" + "\r\n"; String sendCmd = "AT+CIPSEND="; esp.print(sendCmd); esp.println(getRequest.length()); delay(500); if (esp.find(">")) { Serial.println("Sending.."); esp.print(getRequest); if (esp.find("SEND OK")) { Serial.println("Packet sent"); while (esp.available()) { String response = esp.readString(); Serial.println("response.." + response); } esp.println("AT+CIPCLOSE"); } } } void loop() { httpget(); } String sendData(String command, const int timeout, boolean debug) // Function to send the data to the esp8266 { String response = ""; esp.print(command); // Send the command to the ESP8266 long int time = millis(); while ( (time + timeout) > millis()) // ESP8266 will wait for some time for the data to receive { while (esp.available()) // Checking whether ESP8266 has received the data or not { char c = esp.read(); // Read the next character. response += c; // Storing the response from the ESP8266 } } if (debug) { Serial.print(response); // Printing the response of the ESP8266 on the serial monitor. } return response; }

中创建about.blade.php