Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
hfpp2012
/
laravel-blog
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
You need to sign in or sign up before continuing.
Commit bc2186e5
authored
Aug 12, 2017
by
hfpp2012 yinsigan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
给view传递变量
1 parent
f5721e0e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
app/Http/Controllers/PagesController.php
resources/views/pages/index.blade.php
routes/web.php
app/Http/Controllers/PagesController.php
0 → 100644
View file @
bc2186e
<?php
namespace
App\Http\Controllers
;
use
Illuminate\Http\Request
;
use
View
;
class
PagesController
extends
Controller
{
public
function
index
()
{
if
(
View
::
exists
(
'pages.index'
))
return
view
(
'pages.index'
)
->
with
(
'text'
,
'<b>Laravel</b>'
)
->
with
(
'name'
,
'Nicole'
);
# return view('pages.index', ['text' => '<b>Laravel</b>', 'name' => 'Nicole']);
else
return
'No view available'
;
}
}
resources/views/pages/index.blade.php
0 → 100644
View file @
bc2186e
Hello, from index in pages folder.
<p>
{!! $text !!}
</p>
<p>
{{ $text }}
</p>
<p>
{{ $name }}
</p>
routes/web.php
View file @
bc2186e
...
...
@@ -11,9 +11,7 @@
|
*/
Route
::
get
(
'/'
,
function
()
{
return
view
(
'welcome'
);
});
Route
::
get
(
'/'
,
'PagesController@index'
);
// Route::get('/users', function () {
// $users = [
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment