|
|
@ -108,8 +108,21 @@ Pour cela, utilisez le module
|
|
|
|
|
|
|
|
|
|
|
|
- En dernier recours : https://sancy.iut.uca.fr/~puys/btc.json
|
|
|
|
- En dernier recours : https://sancy.iut.uca.fr/~puys/btc.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
|
|
|
// Rappels pour lire un fichier JSON en PHP
|
|
|
|
|
|
|
|
$path = 'var/twoks_db.json';
|
|
|
|
|
|
|
|
$jsonString = file_get_contents($path);
|
|
|
|
|
|
|
|
$jsonData = json_decode($jsonString, true);
|
|
|
|
|
|
|
|
var_dump($jsonData);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Rappels pour écrire un fichier JSON en PHP
|
|
|
|
|
|
|
|
$path = 'new-file.json';
|
|
|
|
|
|
|
|
$jsonString = json_encode($jsonData, JSON_PRETTY_PRINT);
|
|
|
|
|
|
|
|
file_put_contents($path, $jsonString);
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
7. Modifiez ensuite le template `Twig` crée par la console `Symfony` pour qu'il
|
|
|
|
7. Modifiez ensuite le template `Twig` crée par la console `Symfony` pour qu'il
|
|
|
|
prenne en entrée une citation et son auteur et les affiche:
|
|
|
|
prenne en entrée un nom de cryptomonaie et une valeur et les affiche:
|
|
|
|
|
|
|
|
|
|
|
|
```twig
|
|
|
|
```twig
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|