Created
March 15, 2020 13:24
-
-
Save PJZ9n/979ac9bed0971e0bb1a06f33572dd5df to your computer and use it in GitHub Desktop.
Webサーバー(使う側)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //とても単純な例で、そのまま使うことを前提としていません | |
| //同一ディレクトリに所持金記録用のmoney.jsonがあるとする | |
| //処理金を返す | |
| function getMoney(string $name): string { | |
| $moneys = json_decode(file_get_contents("money.json"), true); | |
| return $moneys[$name]; | |
| } | |
| ?> | |
| <!-- 所持金の表示 --> | |
| <h1>ABCさんの所持金: <?php echo getMoney("ABC") ?></h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment