php:php
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| php:php [2018/08/28 07:59] โ [Install PHPUnit] admin | php:php [2022/10/29 16:15] (current) โ external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 45: | Line 45: | ||
| * Explain config: | * Explain config: | ||
| Config turn on debug log in **ngix with php-fpm backend**: | Config turn on debug log in **ngix with php-fpm backend**: | ||
| - | < | + | * in php-fpm.conf< |
| [global] | [global] | ||
| error_log = / | error_log = / | ||
| Line 51: | Line 51: | ||
| [www] | [www] | ||
| catch_workers_output = yes | catch_workers_output = yes | ||
| + | </ | ||
| + | * in php.ini:< | ||
| + | display_errors = On โ Allow display debug information in front end | ||
| </ | </ | ||
| Config turn on/off log in httpd: | Config turn on/off log in httpd: | ||
| Line 404: | Line 407: | ||
| </ | </ | ||
| => mysqli_connect(" | => mysqli_connect(" | ||
| + | </ | ||
| + | ===== PHP curl ===== | ||
| + | <code php> | ||
| + | <?php | ||
| + | function curl_post($url, | ||
| + | { | ||
| + | try{ | ||
| + | $ch = curl_init(); | ||
| + | if ($ch === false) { | ||
| + | throw new Exception(' | ||
| + | } | ||
| + | curl_setopt($ch, | ||
| + | curl_setopt($ch, | ||
| + | curl_setopt($ch, | ||
| + | curl_setopt($ch, | ||
| + | curl_setopt($ch, | ||
| + | $data = curl_exec($ch); | ||
| + | if ($data === false) { | ||
| + | throw new Exception(curl_error($ch), | ||
| + | } | ||
| + | curl_close($ch); | ||
| + | }catch(Exception $e){ | ||
| + | echo "Curl Error: " . $e-> | ||
| + | } | ||
| + | if($data) | ||
| + | return $data; | ||
| + | else | ||
| + | return false; | ||
| + | } | ||
| </ | </ | ||
php/php.1535443179.txt.gz ยท Last modified: (external edit)
