Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iqdevTranningProj
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Александр Плохих
iqdevTranningProj
Commits
31431e3c
Commit
31431e3c
authored
1 year ago
by
Akex
Committed by
Александр Плохих
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
make controller
parent
295a6342
No related branches found
Branches containing commit
No related tags found
1 merge request
!8
make controller
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public/helloWorld.html
+10
-0
10 additions, 0 deletions
public/helloWorld.html
src/Controller/ReadLogFileController.php
+28
-0
28 additions, 0 deletions
src/Controller/ReadLogFileController.php
with
38 additions
and
0 deletions
public/helloWorld.html
0 → 100644
+
10
−
0
View file @
31431e3c
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Title
</title>
</head>
<body>
hello World
</body>
</html>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/Controller/ReadLogFileController.php
0 → 100644
+
28
−
0
View file @
31431e3c
<?php
namespace
App\Controller
;
use
Symfony\Bundle\FrameworkBundle\Controller\AbstractController
;
use
Symfony\Component\Filesystem\Filesystem
;
use
Symfony\Component\HttpFoundation\Response
;
use
Symfony\Component\Routing\Attribute\Route
;
class
ReadLogFileController
extends
AbstractController
{
/**
* Принимает путь до файла,
* проверяет, что файл существует и выводит пользователю весь контент файла
* (файл можешь создать любой)
*
* @param string $filePath путь до файла
* @return Response */
#[Route('/read/{filePath}', name: 'app_read_log_file', methods: ['GET'])]
public
function
index
(
string
$filePath
):
Response
{
$fileSystem
=
new
Filesystem
();
if
(
!
$fileSystem
->
exists
(
$filePath
))
{
return
new
Response
(
'File not found'
,
Response
::
HTTP_NOT_FOUND
);
}
return
new
Response
(
file_get_contents
(
$filePath
),
Response
::
HTTP_OK
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment