T
T
TedMarsh2021-06-27 16:48:01
PHP
TedMarsh, 2021-06-27 16:48:01

How to change a file in a user session?

This code changes the file on the server:

$html = file_get_contents("index.html");
$html = strtr($html, array('Космолёт' => 'Вертолёт'));
file_put_contents("/", $html);
include "index.html";

How to change a file only in the user session and not on the server?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey delphinpro, 2021-06-27
@TedMarsh

Why change the file itself?
Modify the data that is sent to the browser.
There are templates for this. They have conditions.

@if ($user->isAdmin) {
  @include 'footer'
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question