Ukuxazulula “Lokhu kubi / 404 Alitholakalanga iphutha” ngemuva kokufaka “zend-expression”

Ukusebenza nge-middleware, kule Posi sizoxazulula inkinga ye “Lokhu kubi / 404 Alitholakalanga iphutha” ngemuva kokufaka “zend-expression”.

inkinga

Muva nje, onesifiso sokubona ukuthi kanjani I-Middleware sebenza, Ngifakile “zend-Expressive-skeleton” ngokuya ngeNkombandlela “Ukuqala okusheshayo: Usebenzisa iSkeleton + Isifaki”:

$ dala umqambi-iphrojekthi yendframework/zend-veza-skeleton ukuveza

ngemva kwalokhu, ukuhlola umphumela, Ngifinyelele kwisiphequluli ku- http://indawo yasendaweni / ekhanyayo / eyomphakathi / futhi wabamba iphutha elilandelayo:

Hawu!
Lokhu kubi.
 
Sihlangabezane ne 404 Alitholakalanga iphutha.
 
Uyabheka ngoba into engavumiukhona noma kungenzeka uthuthile. Bheka esinye sezixhumanisi ezikuleli khasi noma ubuyela ekhaya.

isixazululo

Umlayezo wephutha uveze ukuthi ikhasi alitholakalanga, Ngakho-ke, kwakubonakala njengenkinga ye-PATH (indlela) kumafayela wohlelo lokusebenza.

Ukubheka nxazonke, Ngiphethe ngokuthi lokhu kwenzeka ngoba angizange ngakhe iphrojekthi ngqo ezimpandeni zomkhombandlela wokushicilela (ex: www / ou htdocs /), kepha ngokulandelana, kanje: http://indawo yasekhaya /veza/umphakathi /.

Nokho, kubonakala sengathi Kuyamangaza ube nobunzima nge Isisekelo Url / Indlela Yesisekelo. Eqinisweni, ukwakhiwa kwezakhiwo zohlaka lwe-Zend ngokwayo kuyavuma ukuthi umkhombandlela wokushicilela kumele kube yiwo “umphakathi /“, kakhulu kangangokuba uma usebenzisa iseva yewebhu ekhomba kuyo “umphakathi /“, uhlelo lusebenza ngokujwayelekile.

Ukugijima umyalo “php -S 0.0.0.0:8080 -t emphakathini /” izinwele ezibulalayo (umyalo):

I-Taylor @ taylor-pc MINGW64 / c / wamp64 / www / expressive
$ php -S 0.0.0.0:8080 -t public/
PHP 7.0.10 I-Development Server iqale kuThuli Aug 10 15:55:00 2017
Ukulalela ku-http://0.0.0.0:8080
Impande yedokhumenti ngu-C:\wamp64\www\expressive\public
Press Ctrl-C to quit.
[Thu Aug 10 15:55:34 2017] 127.0.0.1:65106 [404]: /okusobala / okusobala /

Manje yebo, ngokwenza lokhu kungenzeka ukufinyelela http://indawo yasendaweni / ekhanyayo / eyomphakathi / ngaphandle kwephutha.

Kepha ukuze ungabambeki kulokhu “umphakathi /“, i-middleware ikhona los / basepath njengesixazululo se-workaround. Ukufaka kulula:

$ umqambi dinga le/basepath

ngemva kwalokhu, vele ungeze i-Middleware njengenye yokuqala kwesicelo sakho. isibonelo, Ngifaka ucingo efayeleni “okusesidlangalaleni index.php”, emva nje kwalokho “$uhlelo lokusebenza” iqaliwe:

1
$uhlelo lokusebenza->ipayipi(new \I-LosMiddleware  BasePath  BasePath('/ ukuveza obala / esidlangalaleni'));

Yilokho kuphela!

Inkomba

Ukufinyelela / indlela / kuya / esidlangalaleni kutholile 404 ikhasi
Isisekelo Path Middleware ye-PHP

Imininingwane zokungena: 5125

A kumazwana “Ukuxazulula “Lokhu kubi / 404 Alitholakalanga iphutha” ngemuva kokufaka “zend-expression”

Shiya impendulo

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *