Son aktivite 1740032833

php

anthony's Avatar anthony bu gisti düzenledi 1740032832. Düzenlemeye git

1 file changed, 32 insertions

output.php(dosya oluşturuldu)

@@ -0,0 +1,32 @@
1 + <?php
2 + function output(...$data)
3 + {
4 + $result = [];
5 + foreach ($data as $something) {
6 + if ($something instanceof Illuminate\Support\Collection) {
7 + $something = $something->toArray();
8 + }
9 + if (is_array($something)) {
10 + $something = var_export($something, true);
11 + }
12 + if (empty($something)) {
13 + $something = '';
14 + }
15 + if (is_object($something)) {
16 + if (method_exists($something, 'toArray')) {
17 + $something = $something->toArray();
18 + } elseif (method_exists($something, 'jsonSerialize')) {
19 + $something = $something->jsonSerialize();
20 + } else {
21 + $something = var_export($something, true);
22 + }
23 + }
24 + $result[] = $something;
25 + }
26 + file_put_contents(
27 + 'test_' . date('d.m.Y') . '.log',
28 + '[' . date('H:i:s') . '] ' .
29 + implode(' ', $result) . PHP_EOL,
30 + FILE_APPEND
31 + );
32 + }
Daha yeni Daha eski