2016-04-09 18 views
0

Windows 7 sistemimde çalıştırmak için Slim'i almaya çalışıyorum. Şimdiye kadar Composer ile yüklü olan her şeyi aldım ama çok basit bir program çalıştırdığımda çıktı istenen şekilde değil. yerine ben "x" olsun,İnce 3,3 çıktıda eksik karakterler

<?php 
ini_set('display_errors', 1); 
ini_set('display_startup_errors', 1); 
error_reporting(E_ALL); 

use Slim\App; 
use Slim\Http\Request; 
use Slim\Http\Response; 

require '../vendor/autoload.php'; 

$app = new App; 

$app->get('/', function (Request $in, Response $out, $args) { 
return $out->write("xxxxx"); 
}); 

$app->run(); 

Ben çıktı "xxxxx" bekliyorum:

Aşağıda benim kodudur.

Bu, bir yerde 4 karakter kaybettiğim anlamına gelir. Koşu PHP 5.5.12 kodlama UTF-8 (değil BOM) i çalıştırdığınızda

Ben

D:\wamp\www\slim_test\src\public>curl -v http://localhost:8080/ 
* Trying 127.0.0.1... 
* Connected to localhost (127.0.0.1) port 8080 (#0) 
> GET/HTTP/1.1 
> Host: localhost:8080 
> User-Agent: curl/7.46.0 
> Accept: */* 
> 
< HTTP/1.1 200 OK 
< Host: localhost:8080 
< Connection: close 
< X-Powered-By: PHP/5.5.12 
< Content-Type: text/html; charset=UTF-8 
< Content-Length: 5 
< 

x* Closing connection 0 

yardımına takdir ediyorum almak

"http://localhost:8080/ -v kıvrılıp" dir .

EDIT Bu satırları dosya sonuna ekledikten sonra yanıt doğrudur.

$response = $app->run(true); //Silent mode, wont send the response 
$response = $response->withoutHeader("Content-Length"); //Remove the Content-Length 

$app->respond($response); //Now we send the response 

Neden olduğunu anlayamıyorum .....?

cevap

1

Çok aptalca bir hata bulduğum için bu sorun çözüldü.

<?php etiketinden önce 2 boş alanım vardı.