梦入琼楼寒有月,行过石树冻无烟

📖 earlier posts 📖

PHP 连接数据库

mysqli()


mysqli()函数主要是php5和Mysql5版本的写法,但仅仅支持PHP7、MySQL8之前的版本,代码格式如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$server = "127.0.0.1:3306";
$username = "sun";
$passworld = "toor";

$mysqlconn = new mysqli($server,$username,$passworld);

if ($mysqlconn) {
echo "连接失败";
} else {
echo "连接成功";
}
?>
</body>
</html>

MySQL::_ _ construct():(HY000/1045)

MySQL::_ _ construct():(HY000/1045)命令是因为当前PHP环境为PHP版本7、MySQL版本8,所以产生HY000/1045错误,而这是因为MySQL8默认使用了caching_sha2_password身份验证,所以解决方法如下:

创建用户

MySQL 无法登入

首先登入MySQL交互界面,如果MySQL数据库无法登入可以使用my.cnf配置文件,加上密码验证忽略模式:

1
fidn / -name my.cnf            # 搜索my.cnf配置文件
1
skip-grant-tables=1            # 在[mysqld]下加入此代码,用于验证忽略
MySQL 正常登入
1
2
3
use mysql;    # 进入Mysql库
ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'passworld';
flush privileges; # 刷新权限

更多可参考:php7.2连接mysql8中遇到的坑

配置文件

搜索配置文件
1
find / -name php.ini    # 搜索php.ini配置文件

之后可以使用vi/vim,nano,gedit等其他编辑方式直接对php.ini配置文件进行配置与修改;

修改配置文件

如果你不知道如何修改配置文件,可参考下我当前的PHP配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
[PHP]

;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.

; PHP attempts to find and load this configuration from a number of locations.
; The following is a summary of its search order:
; 1. SAPI module specific location.
; 2. The PHPRC environment variable. (As of PHP 5.2.0)
; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0)
; 4. Current working directory (except CLI)
; 5. The web server's directory (for SAPI modules), or directory of PHP
; (otherwise in Windows)
; 6. The directory from the --with-config-file-path compile time option, or the
; Windows directory (C:\windows or C:\winnt)
; See the PHP docs for more specific information.
; http://php.net/configuration.file

; The syntax of the file is extremely simple. Whitespace and Lines
; beginning with a semicolon are silently ignored (as you probably guessed).
; Section headers (e.g. [Foo]) are also silently ignored, even though
; they might mean something in the future.

; Directives following the section heading [PATH=/www/mysite] only
; apply to PHP files in the /www/mysite directory. Directives
; following the section heading [HOST=www.example.com] only apply to
; PHP files served from www.example.com. Directives set in these
; special sections cannot be overridden by user-defined INI files or
; at runtime. Currently, [PATH=] and [HOST=] sections only work under
; CGI/FastCGI.
; http://php.net/ini.sections

; Directives are specified using the following syntax:
; directive = value
; Directive names are *case sensitive* - foo=bar is different from FOO=bar.
; Directives are variables used to configure PHP or PHP extensions.
; There is no name validation. If PHP can't find an expected
; directive because it is not set or is mistyped, a default value will be used.

; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one
; of the INI constants (On, Off, True, False, Yes, No and None) or an expression
; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a
; previously set variable or directive (e.g. ${foo})

; Expressions in the INI file are limited to bitwise operators and parentheses:
; | bitwise OR
; ^ bitwise XOR
; & bitwise AND
; ~ bitwise NOT
; ! boolean NOT

; Boolean flags can be turned on using the values 1, On, True or Yes.
; They can be turned off using the values 0, Off, False or No.

; An empty string can be denoted by simply not writing anything after the equal
; sign, or by using the None keyword:

; foo = ; sets foo to an empty string
; foo = None ; sets foo to an empty string
; foo = "None" ; sets foo to the string 'None'

; If you use constants in your value, and these constants belong to a
; dynamically loaded extension (either a PHP extension or a Zend extension),
; you may only use these constants *after* the line that loads the extension.

;;;;;;;;;;;;;;;;;;;
; About this file ;
;;;;;;;;;;;;;;;;;;;
; PHP comes packaged with two INI files. One that is recommended to be used
; in production environments and one that is recommended to be used in
; development environments.

; php.ini-production contains settings which hold security, performance and
; best practices at its core. But please be aware, these settings may break
; compatibility with older or less security conscience applications. We
; recommending using the production ini in production and testing environments.

; php.ini-development is very similar to its production variant, except it's
; much more verbose when it comes to errors. We recommending using the
; development version only in development environments as errors shown to
; application users can inadvertently leak otherwise secure information.

;;;;;;;;;;;;;;;;;;;
; Quick Reference ;
;;;;;;;;;;;;;;;;;;;
; The following are all the settings which are different in either the production
; or development versions of the INIs with respect to PHP's default behavior.
; Please see the actual settings later in the document for more details as to why
; we recommend these changes in PHP's behavior.

; allow_call_time_pass_reference
; Default Value: On
; Development Value: Off
; Production Value: Off

; display_errors
; Default Value: On
; Development Value: On
; Production Value: Off

; display_startup_errors
; Default Value: Off
; Development Value: On
; Production Value: Off

; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED

; html_errors
; Default Value: On
; Development Value: On
; Production value: Off

; log_errors
; Default Value: Off
; Development Value: On
; Production Value: On

; magic_quotes_gpc
; Default Value: On
; Development Value: Off
; Production Value: Off

; max_input_time
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)

; output_buffering
; Default Value: Off
; Development Value: 4096
; Production Value: 4096

; register_argc_argv
; Default Value: On
; Development Value: Off
; Production Value: Off

; register_long_arrays
; Default Value: On
; Development Value: Off
; Production Value: Off

; request_order
; Default Value: None
; Development Value: "GP"
; Production Value: "GP"

; session.bug_compat_42
; Default Value: On
; Development Value: On
; Production Value: Off

; session.bug_compat_warn
; Default Value: On
; Development Value: On
; Production Value: Off

; session.gc_divisor
; Default Value: 100
; Development Value: 1000
; Production Value: 1000

; session.hash_bits_per_character
; Default Value: 4
; Development Value: 5
; Production Value: 5

; short_open_tag
; Default Value: On
; Development Value: Off
; Production Value: Off

; track_errors
; Default Value: Off
; Development Value: On
; Production Value: Off

; url_rewriter.tags
; Default Value: "a=href,area=href,frame=src,form=,fieldset="
; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"

; variables_order
; Default Value: "EGPCS"
; Development Value: "GPCS"
; Production Value: "GPCS"

;;;;;;;;;;;;;;;;;;;;
; php.ini Options ;
;;;;;;;;;;;;;;;;;;;;
; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini"
;user_ini.filename = ".user.ini"

; To disable this feature set this option to empty value
;user_ini.filename =

; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes)
;user_ini.cache_ttl = 300

;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;

; Enable the PHP scripting language engine under Apache.
; http://php.net/engine
engine=On

; This directive determines whether or not PHP will recognize code between
; <? and ?> tags as PHP source which should be processed as such. It's been
; recommended for several years that you not use the short tag "short cut" and
; instead to use the full <?php and ?> tag combination. With the wide spread use
; of XML and use of these tags by other languages, the server can become easily
; confused and end up parsing the wrong code in the wrong context. But because
; this short cut has been a feature for such a long time, it's currently still
; supported for backwards compatibility, but we recommend you don't use them.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/short-open-tag
short_open_tag=Off
; XAMPP for Linux is currently old fashioned
short_open_tag=On

; Allow ASP-style <% %> tags.
; http://php.net/asp-tags
asp_tags=Off

; The number of significant digits displayed in floating point numbers.
; http://php.net/precision
precision=14

; Enforce year 2000 compliance (will cause problems with non-compliant browsers)
; http://php.net/y2k-compliance
y2k_compliance=On

; Output buffering is a mechanism for controlling how much output data
; (excluding headers and cookies) PHP should keep internally before pushing that
; data to the client. If your application's output exceeds this setting, PHP
; will send that data in chunks of roughly the size you specify.
; Turning on this setting and managing its maximum buffer size can yield some
; interesting side-effects depending on your application and web server.
; You may be able to send headers and cookies after you've already sent output
; through print or echo. You also may see performance benefits if your server is
; emitting less packets due to buffered output versus PHP streaming the output
; as it gets it. On production servers, 4096 bytes is a good setting for performance
; reasons.
; Note: Output buffering can also be controlled via Output Buffering Control
; functions.
; Possible Values:
; On = Enabled and buffer is unlimited. (Use with caution)
; Off = Disabled
; Integer = Enables the buffer and sets its maximum size in bytes.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: Off
; Development Value: 4096
; Production Value: 4096
; http://php.net/output-buffering
output_buffering=4096

; You can redirect all of the output of your scripts to a function. For
; example, if you set output_handler to "mb_output_handler", character
; encoding will be transparently converted to the specified encoding.
; Setting any output handler automatically turns on output buffering.
; Note: People who wrote portable scripts should not depend on this ini
; directive. Instead, explicitly set the output handler using ob_start().
; Using this ini directive may cause problems unless you know what script
; is doing.
; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler"
; and you cannot use both "ob_gzhandler" and "zlib.output_compression".
; Note: output_handler must be empty if this is set 'On' !!!!
; Instead you must use zlib.output_handler.
; http://php.net/output-handler
;output_handler =

; Transparent output compression using the zlib library
; Valid values for this option are 'off', 'on', or a specific buffer size
; to be used for compression (default is 4KB)
; Note: Resulting chunk size may vary due to nature of compression. PHP
; outputs chunks that are few hundreds bytes each as a result of
; compression. If you prefer a larger chunk size for better
; performance, enable output_buffering in addition.
; Note: You need to use zlib.output_handler instead of the standard
; output_handler, or otherwise the output will be corrupted.
; http://php.net/zlib.output-compression
zlib.output_compression=Off

; http://php.net/zlib.output-compression-level
;zlib.output_compression_level = -1

; You cannot specify additional output handlers if zlib.output_compression
; is activated here. This setting does the same as output_handler but in
; a different order.
; http://php.net/zlib.output-handler
;zlib.output_handler =

; Implicit flush tells PHP to tell the output layer to flush itself
; automatically after every output block. This is equivalent to calling the
; PHP function flush() after each and every call to print() or echo() and each
; and every HTML block. Turning this option on has serious performance
; implications and is generally recommended for debugging purposes only.
; http://php.net/implicit-flush
; Note: This directive is hardcoded to On for the CLI SAPI
implicit_flush=Off

; The unserialize callback function will be called (with the undefined class'
; name as parameter), if the unserializer finds an undefined class
; which should be instantiated. A warning appears if the specified function is
; not defined, or if the function doesn't include/implement the missing class.
; So only set this entry, if you really want to implement such a
; callback-function.
unserialize_callback_func=

; When floats & doubles are serialized store serialize_precision significant
; digits after the floating point. The default value ensures that when floats
; are decoded with unserialize, the data will remain the same.
serialize_precision=100

; This directive allows you to enable and disable warnings which PHP will issue
; if you pass a value by reference at function call time. Passing values by
; reference at function call time is a deprecated feature which will be removed
; from PHP at some point in the near future. The acceptable method for passing a
; value by reference to a function is by declaring the reference in the functions
; definition, not at call time. This directive does not disable this feature, it
; only determines whether PHP will warn you about it or not. These warnings
; should enabled in development environments only.
; Default Value: On (Suppress warnings)
; Development Value: Off (Issue warnings)
; Production Value: Off (Issue warnings)
; http://php.net/allow-call-time-pass-reference
allow_call_time_pass_reference=Off

; Safe Mode
; http://php.net/safe-mode
safe_mode=Off

; By default, Safe Mode does a UID compare check when
; opening files. If you want to relax this to a GID compare,
; then turn on safe_mode_gid.
; http://php.net/safe-mode-gid
safe_mode_gid=Off

; When safe_mode is on, UID/GID checks are bypassed when
; including files from this directory and its subdirectories.
; (directory must also be in include_path or full path must
; be used when including)
; http://php.net/safe-mode-include-dir
safe_mode_include_dir=

; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
; http://php.net/safe-mode-exec-dir
safe_mode_exec_dir=

; Setting certain environment variables may be a potential security breach.
; This directive contains a comma-delimited list of prefixes. In Safe Mode,
; the user may only alter environment variables whose names begin with the
; prefixes supplied here. By default, users will only be able to set
; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR).
; Note: If this directive is empty, PHP will let the user modify ANY
; environment variable!
; http://php.net/safe-mode-allowed-env-vars
safe_mode_allowed_env_vars=PHP_

; This directive contains a comma-delimited list of environment variables that
; the end user won't be able to change using putenv(). These variables will be
; protected even if safe_mode_allowed_env_vars is set to allow to change them.
; http://php.net/safe-mode-protected-env-vars
safe_mode_protected_env_vars=LD_LIBRARY_PATH

; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/open-basedir
;open_basedir =

; This directive allows you to disable certain functions for security reasons.
; It receives a comma-delimited list of function names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/disable-functions
disable_functions=

; This directive allows you to disable certain classes for security reasons.
; It receives a comma-delimited list of class names. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
; http://php.net/disable-classes
disable_classes=

; Colors for Syntax Highlighting mode. Anything that's acceptable in
; <span style="color: ???????"> would work.
; http://php.net/syntax-highlighting
;highlight.string = #DD0000
;highlight.comment = #FF9900
;highlight.keyword = #007700
;highlight.bg = #FFFFFF
;highlight.default = #0000BB
;highlight.html = #000000

; If enabled, the request will be allowed to complete even if the user aborts
; the request. Consider enabling it if executing long requests, which may end up
; being interrupted by the user or a browser timing out. PHP's default behavior
; is to disable this feature.
; http://php.net/ignore-user-abort
;ignore_user_abort = On

; Determines the size of the realpath cache to be used by PHP. This value should
; be increased on systems where PHP opens many files to reflect the quantity of
; the file operations performed.
; http://php.net/realpath-cache-size
;realpath_cache_size = 16k

; Duration of time, in seconds for which to cache realpath information for a given
; file or directory. For systems with rarely changing files, consider increasing this
; value.
; http://php.net/realpath-cache-ttl
;realpath_cache_ttl = 120

;;;;;;;;;;;;;;;;;
; Miscellaneous ;
;;;;;;;;;;;;;;;;;

; Decides whether PHP may expose the fact that it is installed on the server
; (e.g. by adding its signature to the Web server header). It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
; http://php.net/expose-php
expose_php=On

;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time=120

; Maximum amount of time each script may spend parsing request data. It's a good
; idea to limit this time on productions servers in order to eliminate unexpectedly
; long running scripts.
; Note: This directive is hardcoded to -1 for the CLI SAPI
; Default Value: -1 (Unlimited)
; Development Value: 60 (60 seconds)
; Production Value: 60 (60 seconds)
; http://php.net/max-input-time
max_input_time=60

; Maximum input variable nesting level
; http://php.net/max-input-nesting-level
;max_input_nesting_level = 64

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit=512M

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; This directive informs PHP of which errors, warnings and notices you would like
; it to take action for. The recommended way of setting values for this
; directive is through the use of the error level constants and bitwise
; operators. The error level constants are below here for convenience as well as
; some common settings and their meanings.
; By default, PHP is set to take action on all errors, notices and warnings EXCEPT
; those related to E_NOTICE and E_STRICT, which together cover best practices and
; recommended coding standards in PHP. For performance reasons, this is the
; recommend error reporting setting. Your production server shouldn't be wasting
; resources complaining about best practices and coding standards. That's what
; development servers and development settings are for.
; Note: The php.ini-development file has this setting as E_ALL | E_STRICT. This
; means it pretty much reports everything which is exactly what you want during
; development and early testing.
;
; Error Level Constants:
; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0)
; E_ERROR - fatal run-time errors
; E_RECOVERABLE_ERROR - almost fatal run-time errors
; E_WARNING - run-time warnings (non-fatal errors)
; E_PARSE - compile-time parse errors
; E_NOTICE - run-time notices (these are warnings which often result
; from a bug in your code, but it's possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it's automatically initialized to an
; empty string)
; E_STRICT - run-time notices, enable to have PHP suggest changes
; to your code which will ensure the best interoperability
; and forward compatibility of your code
; E_CORE_ERROR - fatal errors that occur during PHP's initial startup
; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's
; initial startup
; E_COMPILE_ERROR - fatal compile-time errors
; E_COMPILE_WARNING - compile-time warnings (non-fatal errors)
; E_USER_ERROR - user-generated error message
; E_USER_WARNING - user-generated warning message
; E_USER_NOTICE - user-generated notice message
; E_DEPRECATED - warn about code that will not work in future versions
; of PHP
; E_USER_DEPRECATED - user-generated deprecation warnings
;
; Common Values:
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.)
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.)
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
; http://php.net/error-reporting
error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT

; This directive controls whether or not and where PHP will output errors,
; notices and warnings too. Error output is very useful during development, but
; it could be very dangerous in production environments. Depending on the code
; which is triggering the error, sensitive information could potentially leak
; out of your application such as database usernames and passwords or worse.
; It's recommended that errors be logged on production servers rather than
; having the errors sent to STDOUT.
; Possible Values:
; Off = Do not display any errors
; stderr = Display errors to STDERR (affects only CGI/CLI binaries!)
; On or stdout = Display errors to STDOUT
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/display-errors
display_errors=On

; The display of errors which occur during PHP's startup sequence are handled
; separately from display_errors. PHP's default behavior is to suppress those
; errors from clients. Turning the display of startup errors on can be useful in
; debugging configuration problems. But, it's strongly recommended that you
; leave this setting off on production servers.
; Default Value: Off
; Development Value: On
; Production Value: Off
; http://php.net/display-startup-errors
display_startup_errors=On

; Besides displaying errors, PHP can also log errors to locations such as a
; server-specific log, STDERR, or a location specified by the error_log
; directive found below. While errors should not be displayed on productions
; servers they should still be monitored and logging is a great way to do that.
; Default Value: Off
; Development Value: On
; Production Value: On
; http://php.net/log-errors
log_errors=On

; Set maximum length of log_errors. In error_log information about the source is
; added. The default is 1024 and 0 allows to not apply any maximum length at all.
; http://php.net/log-errors-max-len
log_errors_max_len=1024

; Do not log repeated messages. Repeated errors must occur in same file on same
; line unless ignore_repeated_source is set true.
; http://php.net/ignore-repeated-errors
ignore_repeated_errors=Off

; Ignore source of message when ignoring repeated messages. When this setting
; is On you will not log errors with repeated messages from different files or
; source lines.
; http://php.net/ignore-repeated-source
ignore_repeated_source=Off

; If this parameter is set to Off, then memory leaks will not be shown (on
; stdout or in the log). This has only effect in a debug compile, and if
; error reporting includes E_WARNING in the allowed list
; http://php.net/report-memleaks
report_memleaks=On

; This setting is on by default.
;report_zend_debug = 0

; Store the last error/warning message in $php_errormsg (boolean). Setting this value
; to On can assist in debugging and is appropriate for development servers. It should
; however be disabled on production servers.
; Default Value: Off
; Development Value: On
; Production Value: Off
; http://php.net/track-errors
track_errors=On

; Turn off normal error reporting and emit XML-RPC error XML
; http://php.net/xmlrpc-errors
;xmlrpc_errors = 0

; An XML-RPC faultCode
;xmlrpc_error_number = 0

; When PHP displays or logs an error, it has the capability of inserting html
; links to documentation related to that error. This directive controls whether
; those HTML links appear in error messages or not. For performance and security
; reasons, it's recommended you disable this on production servers.
; Note: This directive is hardcoded to Off for the CLI SAPI
; Default Value: On
; Development Value: On
; Production value: Off
; http://php.net/html-errors
html_errors=On

; If html_errors is set On PHP produces clickable error messages that direct
; to a page describing the error or function causing the error in detail.
; You can download a copy of the PHP manual from http://php.net/docs
; and change docref_root to the base URL of your local copy including the
; leading '/'. You must also specify the file extension being used including
; the dot. PHP's default behavior is to leave these settings empty.
; Note: Never use this feature for production boxes.
; http://php.net/docref-root
; Examples
;docref_root = "/phpmanual/"

; http://php.net/docref-ext
;docref_ext = .html

; String to output before an error message. PHP's default behavior is to leave
; this setting blank.
; http://php.net/error-prepend-string
; Example:
;error_prepend_string = "<font color=#ff0000>"

; String to output after an error message. PHP's default behavior is to leave
; this setting blank.
; http://php.net/error-append-string
; Example:
;error_append_string = "</font>"

; Log errors to specified file. PHP's default behavior is to leave this value
; empty.
; http://php.net/error-log
; Example:
;error_log = php_errors.log
error_log="/opt/lampp/logs/php_error_log"
; Log errors to syslog (Event Log on NT, not valid in Windows 95).
;error_log = syslog

;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;

; Note - track_vars is ALWAYS enabled

; The separator used in PHP generated URLs to separate arguments.
; PHP's default setting is "&".
; http://php.net/arg-separator.output
; Example:
;arg_separator.output = "&amp;"

; List of separator(s) used by PHP to parse input URLs into variables.
; PHP's default setting is "&".
; NOTE: Every character in this directive is considered as separator!
; http://php.net/arg-separator.input
; Example:
;arg_separator.input = ";&"

; This directive determines which super global arrays are registered when PHP
; starts up. If the register_globals directive is enabled, it also determines
; what order variables are populated into the global space. G,P,C,E & S are
; abbreviations for the following respective super globals: GET, POST, COOKIE,
; ENV and SERVER. There is a performance penalty paid for the registration of
; these arrays and because ENV is not as commonly used as the others, ENV is
; is not recommended on productions servers. You can still get access to
; the environment variables through getenv() should you need to.
; Default Value: "EGPCS"
; Development Value: "GPCS"
; Production Value: "GPCS";
; http://php.net/variables-order
variables_order="GPCS"

; This directive determines which super global data (G,P,C,E & S) should
; be registered into the super global array REQUEST. If so, it also determines
; the order in which that data is registered. The values for this directive are
; specified in the same manner as the variables_order directive, EXCEPT one.
; Leaving this value empty will cause PHP to use the value set in the
; variables_order directive. It does not mean it will leave the super globals
; array REQUEST empty.
; Default Value: None
; Development Value: "GP"
; Production Value: "GP"
; http://php.net/request-order
request_order="GP"

; Whether or not to register the EGPCS variables as global variables. You may
; want to turn this off if you don't want to clutter your scripts' global scope
; with user data. This makes most sense when coupled with track_vars - in which
; case you can access all of the GPC variables through the $HTTP_*_VARS[],
; variables.
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
; http://php.net/register-globals
register_globals=Off

; Determines whether the deprecated long $HTTP_*_VARS type predefined variables
; are registered by PHP or not. As they are deprecated, we obviously don't
; recommend you use them. They are on by default for compatibility reasons but
; they are not recommended on production servers.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/register-long-arrays
register_long_arrays=Off

; This directive determines whether PHP registers $argv & $argc each time it
; runs. $argv contains an array of all the arguments passed to PHP when a script
; is invoked. $argc contains an integer representing the number of arguments
; that were passed when the script was invoked. These arrays are extremely
; useful when running scripts from the command line. When this directive is
; enabled, registering these variables consumes CPU cycles and memory each time
; a script is executed. For performance reasons, this feature should be disabled
; on production servers.
; Note: This directive is hardcoded to On for the CLI SAPI
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/register-argc-argv
register_argc_argv=Off

; When enabled, the SERVER and ENV variables are created when they're first
; used (Just In Time) instead of when the script starts. If these variables
; are not used within a script, having this directive on will result in a
; performance gain. The PHP directives register_globals, register_long_arrays,
; and register_argc_argv must be disabled for this directive to have any affect.
; http://php.net/auto-globals-jit
auto_globals_jit=On

; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
post_max_size=40M

; Magic quotes are a preprocessing feature of PHP where PHP will attempt to
; escape any character sequences in GET, POST, COOKIE and ENV data which might
; otherwise corrupt data being placed in resources such as databases before
; making that data available to you. Because of character encoding issues and
; non-standard SQL implementations across many databases, it's not currently
; possible for this feature to be 100% accurate. PHP's default behavior is to
; enable the feature. We strongly recommend you use the escaping mechanisms
; designed specifically for the database your using instead of relying on this
; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is
; scheduled for removal in PHP 6.
; Default Value: On
; Development Value: Off
; Production Value: Off
; http://php.net/magic-quotes-gpc
magic_quotes_gpc=Off

; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
; http://php.net/magic-quotes-runtime
magic_quotes_runtime=Off

; Use Sybase-style magic quotes (escape ' with '' instead of \').
; http://php.net/magic-quotes-sybase
magic_quotes_sybase=Off

; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
auto_prepend_file=

; Automatically add files after PHP document.
; http://php.net/auto-append-file
auto_append_file=

; By default, PHP will output a character encoding using
; the Content-type: header. To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
; http://php.net/default-mimetype
default_mimetype="text/html"

; PHP's default character set is set to empty.
; http://php.net/default-charset
;default_charset = "iso-8859-1"

; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is
; to disable this feature.
; http://php.net/always-populate-raw-post-data
;always_populate_raw_post_data = On

;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
;
; PHP's default setting for include_path is ".;/path/to/php/pear"
; http://php.net/include-path

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues. The alternate is to use the
; cgi.force_redirect configuration below
; http://php.net/doc-root
doc_root=

; The directory under which PHP opens the script using /~username used only
; if nonempty.
; http://php.net/user-dir
user_dir=

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext"

; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
; http://php.net/enable-dl
enable_dl=Off

; cgi.force_redirect is necessary to provide security running PHP as a CGI under
; most web servers. Left undefined, PHP turns this on by default. You can
; turn it off here AT YOUR OWN RISK
; **You CAN safely turn this off for IIS, in fact, you MUST.**
; http://php.net/cgi.force-redirect
;cgi.force_redirect = 1

; if cgi.nph is enabled it will force cgi to always sent Status: 200 with
; every request. PHP's default behavior is to disable this feature.
;cgi.nph = 1

; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape
; (iPlanet) web servers, you MAY need to set an environment variable name that PHP
; will look for to know it is OK to continue execution. Setting this variable MAY
; cause security issues, KNOW WHAT YOU ARE DOING FIRST.
; http://php.net/cgi.redirect-status-env
;cgi.redirect_status_env = ;

; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is 1. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
;cgi.fix_pathinfo=1

; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate
; security tokens of the calling client. This allows IIS to define the
; security context that the request runs under. mod_fastcgi under Apache
; does not currently support this feature (03/17/2002)
; Set to 1 if running under IIS. Default is zero.
; http://php.net/fastcgi.impersonate
;fastcgi.impersonate = 1;

; Disable logging through FastCGI connection. PHP's default behavior is to enable
; this feature.
;fastcgi.logging = 0

; cgi.rfc2616_headers configuration option tells PHP what type of headers to
; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
; is supported by Apache. When this option is set to 1 PHP will send
; RFC2616 compliant header.
; Default is zero.
; http://php.net/cgi.rfc2616-headers
;cgi.rfc2616_headers = 0

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads=On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =
upload_tmp_dir="/opt/lampp/temp/"
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize=40M

;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-fopen
allow_url_fopen=On

; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-include
allow_url_include=Off

; Define the anonymous ftp password (your email address). PHP's default setting
; for this is empty.
; http://php.net/from
;from="john@doe.com"

; Define the User-Agent string. PHP's default setting for this is empty.
; http://php.net/user-agent
;user_agent="PHP"

; Default timeout for socket based streams (seconds)
; http://php.net/default-socket-timeout
default_socket_timeout=60

; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; http://php.net/auto-detect-line-endings
;auto_detect_line_endings = Off

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
; extension=msql.so
;
; ... or with a path:
;
; extension=/path/to/extension/msql.so
;
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
;
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)
; extension folders as well as the separate PECL DLL download (PHP 5).
; Be sure to appropriately set the extension_dir directive.
;
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_exif.dll
;extension=php_fileinfo.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_ming.dll
;extension=php_mssql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client
;extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client
;extension=php_openssl.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_phar.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sqlite3.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll
;extension=php_xsl.dll
;extension=php_zip.dll

;extension="zip.so"

;extension="sqlite.so"

;extension="radius.so"

;extension="pgsql.so"

; disabled in XAMPP 1.7.2 because incompatible with PHP 5.3.0
;extension="dbx.so"

;extension="ming.so"

;extension="ncurses.so"

;extension="dio.so"

;extension="interbase.so"

; disabled in XAMPP 1.7.2 because incompatible with PHP 5.3.0
;extension="eaccelerator.so"
;eaccelerator.shm_size="16"
;eaccelerator.cache_dir="/opt/lampp/temp/eaccelerator"
;eaccelerator.enable="1"
;eaccelerator.optimizer="1"
;eaccelerator.check_mtime="1"
;eaccelerator.debug="0"
;eaccelerator.filter=""
;eaccelerator.shm_max="0"
;eaccelerator.shm_ttl="0"
;eaccelerator.shm_prune_period="0"
;eaccelerator.shm_only="0"
;eaccelerator.compress="1"
;eaccelerator.compress_level="9"

;oci8mark


;zend_extension=opcache.so

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone=Europe/Berlin

; http://php.net/date.default-latitude
;date.default_latitude = 31.7667

; http://php.net/date.default-longitude
;date.default_longitude = 35.2333

; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333

; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333

[filter]
; http://php.net/filter.default
;filter.default = unsafe_raw

; http://php.net/filter.default-flags
;filter.default_flags =

[iconv]
;iconv.input_encoding = ISO-8859-1
;iconv.internal_encoding = ISO-8859-1
;iconv.output_encoding = ISO-8859-1

[intl]
;intl.default_locale =

[sqlite]
; http://php.net/sqlite.assoc-case
;sqlite.assoc_case = 0

[sqlite3]
;sqlite3.extension_dir =

[Pcre]
;PCRE library backtracking limit.
; http://php.net/pcre.backtrack-limit
;pcre.backtrack_limit=100000

;PCRE library recursion limit.
;Please note that if you set this value to a high number you may consume all
;the available process stack and eventually crash PHP (due to reaching the
;stack size limit imposed by the Operating System).
; http://php.net/pcre.recursion-limit
;pcre.recursion_limit=100000

[Pdo]
; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off"
; http://php.net/pdo-odbc.connection-pooling
;pdo_odbc.connection_pooling=strict

;pdo_odbc.db2_instance_name

[Pdo_mysql]
; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/pdo_mysql.cache_size
pdo_mysql.cache_size=2000

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
; http://php.net/pdo_mysql.default-socket
pdo_mysql.default_socket=

[Phar]
; http://php.net/phar.readonly
;phar.readonly = On

; http://php.net/phar.require-hash
;phar.require_hash = On

;phar.cache_list =

[Syslog]
; Whether or not to define the various syslog variables (e.g. $LOG_PID,
; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In
; runtime, you can define these variables by calling define_syslog_variables().
; http://php.net/define-syslog-variables
define_syslog_variables=Off

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=localhost
; http://php.net/smtp-port
smtp_port=25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=On

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log =

[SQL]
; http://php.net/sql.safe-mode
sql.safe_mode=Off

[ODBC]
; http://php.net/odbc.default-db
;odbc.default_db = Not yet implemented

; http://php.net/odbc.default-user
;odbc.default_user = Not yet implemented

; http://php.net/odbc.default-pw
;odbc.default_pw = Not yet implemented

; Controls the ODBC cursor model.
; Default: SQL_CURSOR_STATIC (default).
;odbc.default_cursortype

; Allow or prevent persistent links.
; http://php.net/odbc.allow-persistent
odbc.allow_persistent=On

; Check that a connection is still valid before reuse.
; http://php.net/odbc.check-persistent
odbc.check_persistent=On

; Maximum number of persistent links. -1 means no limit.
; http://php.net/odbc.max-persistent
odbc.max_persistent=-1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
; http://php.net/odbc.max-links
odbc.max_links=-1

; Handling of LONG fields. Returns number of bytes to variables. 0 means
; passthru.
; http://php.net/odbc.defaultlrl
odbc.defaultlrl=4096

; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char.
; See the documentation on odbc_binmode and odbc_longreadlen for an explanation
; of odbc.defaultlrl and odbc.defaultbinmode
; http://php.net/odbc.defaultbinmode
odbc.defaultbinmode=1

;birdstep.max_links = -1

[Interbase]
; Allow or prevent persistent links.
ibase.allow_persistent=1

; Maximum number of persistent links. -1 means no limit.
ibase.max_persistent=-1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
ibase.max_links=-1

; Default database name for ibase_connect().
;ibase.default_db =

; Default username for ibase_connect().
;ibase.default_user =

; Default password for ibase_connect().
;ibase.default_password =

; Default charset for ibase_connect().
;ibase.default_charset =

; Default timestamp format.
ibase.timestampformat="%Y-%m-%d %H:%M:%S"

; Default date format.
ibase.dateformat="%Y-%m-%d"

; Default time format.
ibase.timeformat="%H:%M:%S"

[MySQL]
; Allow accessing, from PHP's perspective, local files with LOAD DATA statements
; http://php.net/mysql.allow_local_infile
mysql.allow_local_infile=On

; Allow or prevent persistent links.
; http://php.net/mysql.allow-persistent
mysql.allow_persistent=On

; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/mysql.cache_size
mysql.cache_size=2000

; Maximum number of persistent links. -1 means no limit.
; http://php.net/mysql.max-persistent
mysql.max_persistent=-1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
; http://php.net/mysql.max-links
mysql.max_links=-1

; Default port number for mysql_connect(). If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
; http://php.net/mysql.default-port
mysql.default_port=

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysql.default-socket
mysql.default_socket=

; Default host for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysql.default-host
mysql.default_host=

; Default user for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysql.default-user
mysql.default_user=

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password! And of course, any users with read access to this
; file will be able to reveal the password as well.
; http://php.net/mysql.default-password
mysql.default_password=

; Maximum time (in seconds) for connect timeout. -1 means no limit
; http://php.net/mysql.connect-timeout
mysql.connect_timeout=60

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
; http://php.net/mysql.trace-mode
mysql.trace_mode=Off

[MySQLi]

; Maximum number of persistent links. -1 means no limit.
; http://php.net/mysqli.max-persistent
mysqli.max_persistent=-1

; Maximum number of links. -1 means no limit.
; http://php.net/mysqli.max-links
mysqli.max_links=-1

; If mysqlnd is used: Number of cache slots for the internal result set cache
; http://php.net/mysqli.cache_size
mysqli.cache_size=2000

; Default port number for mysqli_connect(). If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order). Win32 will only look
; at MYSQL_PORT.
; http://php.net/mysqli.default-port
mysqli.default_port=3306

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
; http://php.net/mysqli.default-socket
mysqli.default_socket=

; Default host for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-host
mysqli.default_host=

; Default user for mysql_connect() (doesn't apply in safe mode).
; http://php.net/mysqli.default-user
mysqli.default_user=

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password! And of course, any users with read access to this
; file will be able to reveal the password as well.
; http://php.net/mysqli.default-pw
mysqli.default_pw=

; Allow or prevent reconnect
mysqli.reconnect=Off

[mysqlnd]
; Enable / Disable collection of general statstics by mysqlnd which can be
; used to tune and monitor MySQL operations.
; http://php.net/mysqlnd.collect_statistics
mysqlnd.collect_statistics=On

; Enable / Disable collection of memory usage statstics by mysqlnd which can be
; used to tune and monitor MySQL operations.
; http://php.net/mysqlnd.collect_memory_statistics
mysqlnd.collect_memory_statistics=On

; Size of a pre-allocated buffer used when sending commands to MySQL in bytes.
; http://php.net/mysqlnd.net_cmd_buffer_size
;mysqlnd.net_cmd_buffer_size = 2048

; Size of a pre-allocated buffer used for reading data sent by the server in
; bytes.
; http://php.net/mysqlnd.net_read_buffer_size
;mysqlnd.net_read_buffer_size = 32768

[OCI8]

; Connection: Enables privileged connections using external
; credentials (OCI_SYSOPER, OCI_SYSDBA)
; http://php.net/oci8.privileged-connect
;oci8.privileged_connect = Off

; Connection: The maximum number of persistent OCI8 connections per
; process. Using -1 means no limit.
; http://php.net/oci8.max-persistent
;oci8.max_persistent = -1

; Connection: The maximum number of seconds a process is allowed to
; maintain an idle persistent connection. Using -1 means idle
; persistent connections will be maintained forever.
; http://php.net/oci8.persistent-timeout
;oci8.persistent_timeout = -1

; Connection: The number of seconds that must pass before issuing a
; ping during oci_pconnect() to check the connection validity. When
; set to 0, each oci_pconnect() will cause a ping. Using -1 disables
; pings completely.
; http://php.net/oci8.ping-interval
;oci8.ping_interval = 60

; Connection: Set this to a user chosen connection class to be used
; for all pooled server requests with Oracle 11g Database Resident
; Connection Pooling (DRCP). To use DRCP, this value should be set to
; the same string for all web servers running the same application,
; the database pool must be configured, and the connection string must
; specify to use a pooled server.
;oci8.connection_class =

; High Availability: Using On lets PHP receive Fast Application
; Notification (FAN) events generated when a database node fails. The
; database must also be configured to post FAN events.
;oci8.events = Off

; Tuning: This option enables statement caching, and specifies how
; many statements to cache. Using 0 disables statement caching.
; http://php.net/oci8.statement-cache-size
;oci8.statement_cache_size = 20

; Tuning: Enables statement prefetching and sets the default number of
; rows that will be fetched automatically after statement execution.
; http://php.net/oci8.default-prefetch
;oci8.default_prefetch = 100

; Compatibility. Using On means oci_close() will not close
; oci_connect() and oci_new_connect() connections.
; http://php.net/oci8.old-oci-close-semantics
;oci8.old_oci_close_semantics = Off

[PostgresSQL]
; Allow or prevent persistent links.
; http://php.net/pgsql.allow-persistent
pgsql.allow_persistent=On

; Detect broken persistent links always with pg_pconnect().
; Auto reset feature requires a little overheads.
; http://php.net/pgsql.auto-reset-persistent
pgsql.auto_reset_persistent=Off

; Maximum number of persistent links. -1 means no limit.
; http://php.net/pgsql.max-persistent
pgsql.max_persistent=-1

; Maximum number of links (persistent+non persistent). -1 means no limit.
; http://php.net/pgsql.max-links
pgsql.max_links=-1

; Ignore PostgreSQL backends Notice message or not.
; Notice message logging require a little overheads.
; http://php.net/pgsql.ignore-notice
pgsql.ignore_notice=0

; Log PostgreSQL backends Noitce message or not.
; Unless pgsql.ignore_notice=0, module cannot log notice message.
; http://php.net/pgsql.log-notice
pgsql.log_notice=0

[Sybase-CT]
; Allow or prevent persistent links.
; http://php.net/sybct.allow-persistent
sybct.allow_persistent=On

; Maximum number of persistent links. -1 means no limit.
; http://php.net/sybct.max-persistent
sybct.max_persistent=-1

; Maximum number of links (persistent + non-persistent). -1 means no limit.
; http://php.net/sybct.max-links
sybct.max_links=-1

; Minimum server message severity to display.
; http://php.net/sybct.min-server-severity
sybct.min_server_severity=10

; Minimum client message severity to display.
; http://php.net/sybct.min-client-severity
sybct.min_client_severity=10

; Set per-context timeout
; http://php.net/sybct.timeout
;sybct.timeout=

;sybct.packet_size

; The maximum time in seconds to wait for a connection attempt to succeed before returning failure.
; Default: one minute
;sybct.login_timeout=

; The name of the host you claim to be connecting from, for display by sp_who.
; Default: none
;sybct.hostname=

; Allows you to define how often deadlocks are to be retried. -1 means "forever".
; Default: 0
;sybct.deadlock_retry_count=

[bcmath]
; Number of decimal digits for all bcmath functions.
; http://php.net/bcmath.scale
bcmath.scale=0

[browscap]
; http://php.net/browscap
;browscap = extra/browscap.ini

[Session]
; Handler used to store/retrieve data.
; http://php.net/session.save-handler
session.save_handler=files

; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
; The path can be defined as:
;
; session.save_path = "N;/path"

session.save_path="/opt/lampp/temp/"

; where N is an integer. Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories. This is useful if you
; or your OS have problems with lots of files in one directory, and is
; a more efficient layout for servers that handle lots of sessions.
;
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
; use subdirectories for session storage
;
; The file storage module creates files using mode 600 by default.
; You can change that by using
;
; session.save_path = "N;MODE;/path"
;
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
; http://php.net/session.save-path
;session.save_path = "/tmp"

; Whether to use cookies.
; http://php.net/session.use-cookies
session.use_cookies=1

; http://php.net/session.cookie-secure
;session.cookie_secure =

; This option forces PHP to fetch and use a cookie for storing and maintaining
; the session id. We encourage this operation as it's very helpful in combatting
; session hijacking when not specifying and managing your own session id. It is
; not the end all be all of session hijacking defense, but it's a good start.
; http://php.net/session.use-only-cookies
session.use_only_cookies=1

; Name of the session (used as cookie name).
; http://php.net/session.name
session.name=PHPSESSID

; Initialize session on request startup.
; http://php.net/session.auto-start
session.auto_start=0

; Lifetime in seconds of cookie or, if 0, until browser is restarted.
; http://php.net/session.cookie-lifetime
session.cookie_lifetime=0

; The path for which the cookie is valid.
; http://php.net/session.cookie-path
session.cookie_path=/

; The domain for which the cookie is valid.
; http://php.net/session.cookie-domain
session.cookie_domain=

; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript.
; http://php.net/session.cookie-httponly
session.cookie_httponly=

; Handler used to serialize data. php is the standard serializer of PHP.
; http://php.net/session.serialize-handler
session.serialize_handler=php

; Defines the probability that the 'garbage collection' process is started
; on every session initialization. The probability is calculated by using
; gc_probability/gc_divisor. Where session.gc_probability is the numerator
; and gc_divisor is the denominator in the equation. Setting this value to 1
; when the session.gc_divisor value is 100 will give you approximately a 1% chance
; the gc will run on any give request.
; Default Value: 1
; Development Value: 1
; Production Value: 1
; http://php.net/session.gc-probability
session.gc_probability=1

; Defines the probability that the 'garbage collection' process is started on every
; session initialization. The probability is calculated by using the following equation:
; gc_probability/gc_divisor. Where session.gc_probability is the numerator and
; session.gc_divisor is the denominator in the equation. Setting this value to 1
; when the session.gc_divisor value is 100 will give you approximately a 1% chance
; the gc will run on any give request. Increasing this value to 1000 will give you
; a 0.1% chance the gc will run on any give request. For high volume production servers,
; this is a more efficient approach.
; Default Value: 100
; Development Value: 1000
; Production Value: 1000
; http://php.net/session.gc-divisor
session.gc_divisor=1000

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
; http://php.net/session.gc-maxlifetime
session.gc_maxlifetime=1440

; NOTE: If you are using the subdirectory option for storing session files
; (see session.save_path above), then garbage collection does *not*
; happen automatically. You will need to do your own garbage
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; cd /path/to/sessions; find -cmin +24 | xargs rm

; PHP 4.2 and less have an undocumented feature/bug that allows you to
; to initialize a session variable in the global scope, even when register_globals
; is disabled. PHP 4.3 and later will warn you, if this feature is used.
; You can disable the feature and the warning separately. At this time,
; the warning is only displayed, if bug_compat_42 is enabled. This feature
; introduces some serious security problems if not handled correctly. It's
; recommended that you do not use this feature on production servers. But you
; should enable this on development servers and enable the warning as well. If you
; do not enable the feature on development servers, you won't be warned when it's
; used and debugging errors caused by this can be difficult to track down.
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/session.bug-compat-42
session.bug_compat_42=On

; This setting controls whether or not you are warned by PHP when initializing a
; session value into the global space. session.bug_compat_42 must be enabled before
; these warnings can be issued by PHP. See the directive above for more information.
; Default Value: On
; Development Value: On
; Production Value: Off
; http://php.net/session.bug-compat-warn
session.bug_compat_warn=On

; Check HTTP Referer to invalidate externally stored URLs containing ids.
; HTTP_REFERER has to contain this substring for the session to be
; considered as valid.
; http://php.net/session.referer-check
session.referer_check=

; How many bytes to read from the file.
; http://php.net/session.entropy-length
session.entropy_length=0

; Specified here to create the session id.
; http://php.net/session.entropy-file
;session.entropy_file = /dev/urandom
session.entropy_file=

; http://php.net/session.entropy-length
;session.entropy_length = 16

; Set to {nocache,private,public,} to determine HTTP caching aspects
; or leave this empty to avoid sending anti-caching headers.
; http://php.net/session.cache-limiter
session.cache_limiter=nocache

; Document expires after n minutes.
; http://php.net/session.cache-expire
session.cache_expire=180

; trans sid support is disabled by default.
; Use of trans sid may risk your users security.
; Use this option with caution.
; - User may send URL contains active session ID
; to other person via. email/irc/etc.
; - URL that contains active session ID may be stored
; in publically accessible computer.
; - User may access your site with the same session ID
; always using URL stored in browser's history or bookmarks.
; http://php.net/session.use-trans-sid
session.use_trans_sid=0

; Select a hash function for use in generating session ids.
; Possible Values
; 0 (MD5 128 bits)
; 1 (SHA-1 160 bits)
; http://php.net/session.hash-function
session.hash_function=0

; Define how many bits are stored in each character when converting
; the binary hash data to something readable.
; Possible values:
; 4 (4 bits: 0-9, a-f)
; 5 (5 bits: 0-9, a-v)
; 6 (6 bits: 0-9, a-z, A-Z, "-", ",")
; Default Value: 4
; Development Value: 5
; Production Value: 5
; http://php.net/session.hash-bits-per-character
session.hash_bits_per_character=5

; The URL rewriter will look for URLs in a defined set of HTML tags.
; form/fieldset are special; if you include them here, the rewriter will
; add a hidden <input> field with the info which is otherwise appended
; to URLs. If you want XHTML conformity, remove the form entry.
; Note that all valid entries require a "=", even if no value follows.
; Default Value: "a=href,area=href,frame=src,form=,fieldset="
; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry"
; http://php.net/url-rewriter.tags
url_rewriter.tags="a=href,area=href,frame=src,input=src,form=fakeentry"

[MSSQL]
; Allow or prevent persistent links.
mssql.allow_persistent=On

; Maximum number of persistent links. -1 means no limit.
mssql.max_persistent=-1

; Maximum number of links (persistent+non persistent). -1 means no limit.
mssql.max_links=-1

; Minimum error severity to display.
mssql.min_error_severity=10

; Minimum message severity to display.
mssql.min_message_severity=10

; Compatibility mode with old versions of PHP 3.0.
mssql.compatability_mode=Off

; Connect timeout
;mssql.connect_timeout = 5

; Query timeout
;mssql.timeout = 60

; Valid range 0 - 2147483647. Default = 4096.
;mssql.textlimit = 4096

; Valid range 0 - 2147483647. Default = 4096.
;mssql.textsize = 4096

; Limits the number of records in each batch. 0 = all records in one batch.
;mssql.batchsize = 0

; Specify how datetime and datetim4 columns are returned
; On => Returns data converted to SQL server settings
; Off => Returns values as YYYY-MM-DD hh:mm:ss
;mssql.datetimeconvert = On

; Use NT authentication when connecting to the server
mssql.secure_connection=Off

; Specify max number of processes. -1 = library default
; msdlib defaults to 25
; FreeTDS defaults to 4096
;mssql.max_procs = -1

; Specify client character set.
; If empty or not set the client charset from freetds.comf is used
; This is only used when compiled with FreeTDS
;mssql.charset = "ISO-8859-1"

[Assertion]
; Assert(expr); active by default.
; http://php.net/assert.active
;assert.active = On

; Issue a PHP warning for each failed assertion.
; http://php.net/assert.warning
;assert.warning = On

; Don't bail out by default.
; http://php.net/assert.bail
;assert.bail = Off

; User-function to be called if an assertion fails.
; http://php.net/assert.callback
;assert.callback = 0

; Eval the expression with current error_reporting(). Set to true if you want
; error_reporting(0) around the eval().
; http://php.net/assert.quiet-eval
;assert.quiet_eval = 0

[COM]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
; http://php.net/com.typelib-file
;com.typelib_file =

; allow Distributed-COM calls
; http://php.net/com.allow-dcom
;com.allow_dcom = true

; autoregister constants of a components typlib on com_load()
; http://php.net/com.autoregister-typelib
;com.autoregister_typelib = true

; register constants casesensitive
; http://php.net/com.autoregister-casesensitive
;com.autoregister_casesensitive = false

; show warnings on duplicate constant registrations
; http://php.net/com.autoregister-verbose
;com.autoregister_verbose = true

; The default character set code-page to use when passing strings to and from COM objects.
; Default: system ANSI code page
;com.code_page=

[mbstring]
; language for internal character representation.
; http://php.net/mbstring.language
;mbstring.language = Japanese

; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
; http://php.net/mbstring.internal-encoding
;mbstring.internal_encoding = EUC-JP

; http input encoding.
; http://php.net/mbstring.http-input
;mbstring.http_input = auto

; http output encoding. mb_output_handler must be
; registered as output buffer to function
; http://php.net/mbstring.http-output
;mbstring.http_output = SJIS

; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
; portable libs/applications.
; http://php.net/mbstring.encoding-translation
;mbstring.encoding_translation = Off

; automatic encoding detection order.
; auto means
; http://php.net/mbstring.detect-order
;mbstring.detect_order = auto

; substitute_character used when character cannot be converted
; one from another
; http://php.net/mbstring.substitute-character
;mbstring.substitute_character = none;

; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
; http://php.net/mbstring.func-overload
;mbstring.func_overload = 0

; enable strict encoding detection.
;mbstring.strict_detection = Off

; This directive specifies the regex pattern of content types for which mb_output_handler()
; is activated.
; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml)
;mbstring.http_output_conv_mimetype=

; Allows to set script encoding. Only affects if PHP is compiled with --enable-zend-multibyte
; Default: ""
;mbstring.script_encoding=

[gd]
; Tell the jpeg decode to ignore warnings and try to create
; a gd image. The warning will then be displayed as notices
; disabled by default
; http://php.net/gd.jpeg-ignore-warning
;gd.jpeg_ignore_warning = 0

[exif]
; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS.
; With mbstring support this will automatically be converted into the encoding
; given by corresponding encode setting. When empty mbstring.internal_encoding
; is used. For the decode settings you can distinguish between motorola and
; intel byte order. A decode setting cannot be empty.
; http://php.net/exif.encode-unicode
;exif.encode_unicode = ISO-8859-15

; http://php.net/exif.decode-unicode-motorola
;exif.decode_unicode_motorola = UCS-2BE

; http://php.net/exif.decode-unicode-intel
;exif.decode_unicode_intel = UCS-2LE

; http://php.net/exif.encode-jis
;exif.encode_jis =

; http://php.net/exif.decode-jis-motorola
;exif.decode_jis_motorola = JIS

; http://php.net/exif.decode-jis-intel
;exif.decode_jis_intel = JIS

[Tidy]
; The path to a default tidy configuration file to use when using tidy
; http://php.net/tidy.default-config
;tidy.default_config = /usr/local/lib/php/default.tcfg

; Should tidy clean and repair output automatically?
; WARNING: Do not use this option if you are generating non-html content
; such as dynamic images
; http://php.net/tidy.clean-output
tidy.clean_output=Off

[soap]
; Enables or disables WSDL caching feature.
; http://php.net/soap.wsdl-cache-enabled
soap.wsdl_cache_enabled=1

; Sets the directory name where SOAP extension will put cache files.
; http://php.net/soap.wsdl-cache-dir
soap.wsdl_cache_dir="/tmp"

; (time to live) Sets the number of second while cached file will be used
; instead of original one.
; http://php.net/soap.wsdl-cache-ttl
soap.wsdl_cache_ttl=86400

; Sets the size of the cache limit. (Max. number of WSDL files to cache)
soap.wsdl_cache_limit=5

[sysvshm]
; A default size of the shared memory segment
;sysvshm.init_mem = 10000

[ldap]
; Sets the maximum number of open links or -1 for unlimited.
ldap.max_links=-1

[mcrypt]
; For more information about mcrypt settings see http://php.net/mcrypt-module-open

; Directory where to load mcrypt algorithms
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.algorithms_dir=

; Directory where to load mcrypt modes
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.modes_dir=

[dba]
;dba.default_handler=

; Local Variables:
; tab-width: 4
; End:

openssl.cafile=/opt/lampp/share/curl/curl-ca-bundle.crt
扩展开启
1
2
extension=php_mysql.dll
extension=php_mysqli.dll

将原本注释掉的扩展包(;extension=php_mysql.dll)将注释去掉然后重启服务即可systemctl restart mysqld

面向过程

在PHP开发语言之中,连接数据库主要可分问面向对象、面向过程等两种风格,其主要使用函数为Mysqli、mysqli_connect、PDO等函数,个根据自身选择喜欢的连接数据库风格,笔者更倾向于面向过程风格。

mysqli_connect()


但使用上述方法连接MySQL,如PHP版本为7,MySQL版本为8,则需要使用mysqli_connect函数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$mysqlconnect = mysqli_connect('127.0.0.1:3306','sun','7e63de77');
if (!$mysqlconnect) {
echo "连接失败";
} else {
echo "连接成功";
}
?>
</body>
</html>

PDO

PDO全称为“PHP数据对象,PHP Data Object”,PDO提供了一个数据访问抽象层,无论使用哪种数据库,都可用相同的函数方法来查询和获取数据库,对于PDO写法本书不做太多解释与例子。

面向对象

mysqli

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$server = '127.0.0.1:3306';
$username = 'sun';
$password = '7e63de77';

$mysqli = new mysqli($server,$username,$password);
if (!$mysqli) {
echo "连接失败";
} else {
echo "连接成功";
}
?>
</body>
</html>

PHP 数据库基础

什么是数据库

所谓动态站点,无非是与用户进行交互和存储的过程,其中在PHP飞速发展的过程中,有许多的数据库可供PHP进行调用与使用。其中最受青睐的无非就是MySQL系统,其因开源、小巧广受开发者们的情迷。

数据库与数据库管理系统

数据库

数据库简称“DB”,即从字面意义上理解是存放数据的仓库,只不过这些数据存在了一定的关联,并按照一定的格式用于存放于计算机或服务器之中。从目前数据库类型支持来讲,数据不仅仅包含文字和数字,还包括了文本、图像、音频、视频等数据。

数据库管理系统

数据库管理系统简称为(“DBMS”),只要用于管理数据,可进行添加、插入、修改表中的列和行的数据,以及删除复制和粘贴的操作,减少了在命令行形式的命令繁琐的难题,从而广受开发者青睐;

数据库定义语言与数据库操作语言(DDL/DML)

DBSM提供了数据的定义语言(DDL,Data Definition Language)以及数据库操作语言(DML,Data Manipulation Language),为用户提供了基本的权限约束,实现了数据库的追加、删除等操作,DBSM主要支持如下:

ID DA FA
1 可定义数据库中是数据对象
2 可对标进行基本操作[^插入、删除、修改、查询]
3 数据库的完整性检查[^可满足用户输入的数据是否满足约束权限]
4 数据库的安全保护功能[^只有赋予权限的用户才可访问数据中的数据]
5 数据库的并发控制[^几个不同的应用程序可同一时间向数据库发送访问请求]
6 数据库的故障恢复功能[^使数据库发生故障时还可进行恢复]
7 在网络的情况下访问数据库功能
8 方便和邮箱的提供了数据库的信息和接口工具

数据库的类型

关系型数据库管理系统

关系型模型是以二维表格,俗称关系表的形式组织和管理数据库中的数据,一个关系型数据库可以有诺干张表,而在关系型数据库中,我们一般将表格中的每一行,称之为记录,而一列称之为“字段”,每列标题称之为字段名.

关系型数据库语言

关系型数据库的标准语言即SQL(结构化查询语言,Sructued Query Language),最早由Boyce和Chambedin在1974年提出。1982年美国国家标准化组织ANSI确定为SQL数据库系统的工业标准,而SQL语言的功能主要包含数据查询、数据操纵、数据定义和数据控制等四部分。

PHP 文件指针

在PHP开发语言之中,共支持feof()、rewind()、ftell()、fseek()等函数进行文件指针操作

判断指针是否处于文件EOF

feof
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1.txt";
$hand = fopen($file, "r");

// 重置指针位置
rewind($hand);

if (feof($hand)) {
echo "当前指针处于文件尾部";
} else {
echo "当前指针不处于指针尾部,处于:",ftell($hand);
}
?>
</body>
</html>

当前指针位置

ftll()

feof()函数主要用于测试文件指针是否处于EOF;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1.txt";
$hand = fopen($file, "r");
// 输出当前指针位置
echo "当前指针为:",ftell($hand)."<br>";

?>
</body>
</html>

挪动指针位置

fseek()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1.txt";
$hand = fopen($file, "r");

// 将指针挪动2
fseek($hand, 2);
echo "当前指针为:",ftell($hand)."<br>";

?>
</body>
</html>

重置指针位置

rewind()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1.txt";
$hand = fopen($file, "r");

// 重置指针位置
rewind($hand);
echo "当前指针为:",ftell($hand)."<br>";
?>
</body>
</html>

PHP 文件上传

在当今时代技术发展旅程中,文件的上传与下载已经成为了一个非常常用的功能,如个人资料中的设置个人头像,也需要用到文件的上传操作。在比如QQ.COM的官网,需要用到文件下载的操作与应用。

PHP 文件上传

获取上传后的文件信息
$_FILES

$_FILES是一个二维数组,主要用途是当文件上传后,依然可以使用该函数获取文件的信息;

文件的上传类型
$FILES['文件’][‘类型’]

文件的常用上传类型主要可以分为以下几种:

ID DA FA
text/plain 表示普通文本文件 文件
text/html 表示HTML文件
image/gif 表示GIF图片 图片
image/pjpeg 表示JPEG图片
iamge/jpeg 用于表示JPEG图片[^Fivefox浏览器]
application/msword 表示Word文件 格式文件
application/pdf 表示PDF文件
application/x-zip-compressed 表示ZIP格式的压缩文件
application/octet-stream 表示二进制流文件[^如EXE、RAR、视频等文件]
audio/mpeg 表示mp3格式音频文件 音频文件
文件上传在服务器时的临时存储名
$FILES[‘文件’][‘临时名称’]

当文件被上传后,文件存储与服务器端,此时我们可以为其增加临时名称,可以用$FILES[‘文件’][‘临时名称’]来解决

以上传的文件大小
$FILES[‘文件’][‘大小’]

已上传的文件大小,单位即为字节。

错误消息代码
$FILES[‘文件’][‘erre’]

在错误信息代码中,值为0 将表示没有错误发生,即文件上传成功值为1即代表上传的文件超过了php.ini文件中upload_max_filesize选项限制的值值为2则表示上传文件的大小超过了HTML表单中规定的最大值值为3则表示文件中只有部分被上传值为4则表示没有文件被上传,而最后值为5则表示上传文件大小为0如下表:

ID DA FA
0 表示没有错误发生,即文件上传成功
1 传的文件超过了php.ini文件中upload_max_filesize选项限制的值
2 上传文件的大小超过了HTML表单中规定的最大值
3 文件中只有部分被上传
4 没有文件被上传
5 文件大小为0
临时存储
move_uploaded_file()

当文件上传结束后,将会默认的存储在临时目录中,这时候必须将其从临时目录中删除或移动到其他地方,无论是否上传成功,都将当脚本执行完后删除;

判断文件是否通过HTTP POST上传
is_uploaded_file()

为避免不发分子或恶意用户是否通过HTTP POST上传,所以PHP的is_uploaded_file()函数进行判断,诺通过HTTP POST上传的则返回TRUE,否则返回FALSE;

文件上传例子
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<form enctype="multipart/form-data" action="" method="post">
<input type="file" name="myFile">
<input type="submit" name="up" value="上传文件">
</form>

<?php
if (isset($_POST['up'])) {
// 判断文件格式是否为JPEG
if ($_FILES['myFile']['type'] == "image/gif") {
if ($_FILES['myFile']['error'] > 0) {
// 临时文件名称
echo "错误:",$_FILES['myFile']['error'];
} else {
// 临时文件名
$tmp_filename = $_FILES['myFile']['tmp_name'];

// 上传的文件名
$filename = $_FILES['myFile']['name'];

// 上传后的文件未知
$dir = $_SERVER['DOCUMENT_ROOT']."/text/";

// 判断是否通过HTTPS POST上传
if (is_uploaded_file($tmp_filename)) {
// 上传并移动文件
if (move_uploaded_file($tmp_filename, "$dir$filename")) {
echo "文件",$filename,"上传成功";

// 输出文件的大小
echo "文件大小为:".($_FILES['myFile']['size']/1024)."KB";
} else {
echo "文件上传失败";
}
}
}
} else {
echo "文件错误,非GIF格式文件";
}
}
?>
</body>
</html>

文件的下载

header()函数主要作用就是向浏览器发送正确的HTTP报头,报头指定了网页的内容和类型,页面属性等信息。header()函数的功能主要用页面跳转指定下载的文件类型 以及文件下载如下:

header()支持表
ID DA FA
Location() 跳转到指定页面 页面跳转
Content-type: 指定下载的文件类型 下载文件类型
readfile() 文件下载 文件下载

文件处理函数

计算文件大小
filesize()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1593173883_1490.gif";
$num = filesize($file);
echo "$num/1024KB";
?>
</body>
</html>
判断文件是否存在
file_exists()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1593173883_1490.gif";
if (file_exists($file)) {
echo "文件存在";
} else {
echo "文件不存在";
}
?>
</body>
</html>
文件删除

在php之中,可使用unlink()函数进行删除不需要的文件,如果删除成功则返回TRUE、否则删除失败则返回FALSE;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1593173883_1490.gif";
// 删除文件
unlink($file);

// 检测文件是否存在
if (file_exists($file)) {
echo "文件存在";
} else {
echo "文件不存在";
}
?>
</body>
</html>
ID DA FA
$_FILES 主要用途是当文件上传后,依然可以使用该函数获取文件的信息; 获取上传后文件信息
$FILES['文件’][‘类型’] 设置当前文件上传的类型 上传类型
文件类型可包括以下几种:
text/plain 表示普通文本文件 文件
text/html 表示HTML文件
image/gif 表示GIF图片 图片
image/pjpeg 表示JPEG图片
iamge/jpeg 用于表示JPEG图片[^Fivefox浏览器]
application/msword 表示Word文件 格式文件
application/pdf 表示PDF文件
application/x-zip-compressed 表示ZIP格式的压缩文件
application/octet-stream 表示二进制流文件[^如EXE、RAR、视频等文件]
audio/mpeg 表示mp3格式音频文件 音频文件
$FILES[‘文件’][‘临时名称’] 临时存放名称 文件上传在服务器时的临时存储名
$FILES[‘文件’][‘大小’] 已上传的文件大小,单位即为字节。 文件的上传大小
$FILES[‘文件’][‘erre’] 在错误信息代码中有如下代码: 错误代码
错误代码:
0 表示没有错误发生,即文件上传成功
1 传的文件超过了php.ini文件中upload_max_filesize选项限制的值
2 上传文件的大小超过了HTML表单中规定的最大值
3 文件中只有部分被上传
4 没有文件被上传
5 文件大小为0
move_uploaded_file() 当文件上传结束后,将会默认的存储在临时目录中,这时候必须将其从临时目录中删除或移动到其他地方,无论是否上传成功,都将当脚本执行完后删除; 临时存储
is_uploaded_file() 判断文件是否通过HTTP POST上传 HTTP POST
filesize() 计算文件大小 文件处理函数
file_exists() 判断文件是否存在
unlink() 删除文件

PHP I/O

I/O即输出流和输入流,通常I/O流在开发语言之中非常常见,如Java、Python都支持I/O流。所谓I/O流无非就是输出文件、写入文件,通常I/O流包含了打开、读取、关闭、删除等常用操作。

目录

创建目录与获取目录及删除目录

创建目录
mkdir()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
if (mkdir(demo)) {
echo "创建成功";
} else {
echo "创建失败";
}
?>
</body>
</html>
删除目录
rmdir()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
mkdir("test");
if (rmdir("test")) {
echo "删除成功";
} else {
echo "删除失败";
}
?>
</body>
</html>
工作目录的获取与修改
getcwd()

getcwd()函数可以获取当前程序所处的目录,使用此函数可以获取到当前的工作目录。

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
echo getcwd();
?>
</body>
</html>
chdir()

chidir()函数可以直接设置当前的工作目录,也就是说使用此函数可以指定工作目录:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
mkdir("/test");
chdir('/test');
echo getcwd();
?>
</body>
</html>

打开与关闭目录句柄

当文件和目录的访问都是通过句柄来实现的,而句柄就是打开一个文件所产生的变量$n即称之为句柄,操作完成后为了避免系统资源的小号应关闭句柄。如打开成功则返回TRUE,否则返回FALSE。而在PHP I/O中,打开句柄通常使用**opendir()来表示,而关闭句柄使用closedir()**来实现。

打开句柄
opendir()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$mkdir = "/Users";
$mkdir_open = opendir($mkdir);
if ($mkdir_open) {
echo "目录句柄打开成功";
} else {
echo "目录句柄打开失败";
}
?>
</body>
</html>
关闭句柄
closedir()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$mkdir = "/Users";
$mkdir_open = opendir($mkdir);
if ($mkdir_open) {
echo "目录句柄打开成功";
} else {
echo "目录句柄打开失败";
}
closedir($mkdir_open);
?>
</body>
</html>

读取目录内容

PHP主要为开发者提供了**readdir()**函数用于读取目录内容,该参数是一个已经打开的目录句柄。在每次调用时返回目录下一个文件的文件名,列出来所有的文件名后,函数将返回FALSE,所以readdir()函数也可用于进行目录遍历。

读取目录内容
readdir()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$dir = "/test";
$dir_open = opendir($dir); // 打开目录句柄
if ($dir_open) {
// 通过readdir()函数返回值是否为FALSE,直到判断至最后一个文件
while (false !== ($file = readdir($dir_open))) {
echo $file,"<br>";
}
closedir($dir_open); // 关闭目录句柄
} else {
echo "打开目录失败";
}
?>
</body>
</html>
获取指定的目录和文件
scandir()

scandir()函数主要用于列出指定路径中的目录和文件,如果函数运行成功则返回该路径下的所有目录和文件名的数组,失败则返回FALSE。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$dir = "/";
$one = scandir($dir);
if ($one == FALSE) {
echo "读取失败";
} else {
print_r($one);
echo "<br>";
}
?>
</body>
</html>

文件

文件和目录之间的操作有一定的类似,一般操作文件方法主要分为打开、读取、写入、关闭等,与目录一样,如果要写入文件,则需要打开文件,之后为了避免占用太多资源则会关闭文件,在PHP文件流之中,主要可以使用**fopen()、fclose()**函数分别进行打开文件和关闭流操作

文件打开与关闭

文件访问权限
ID DA FA
r 只读方式打开文件[^从头读写] r
r+ 读写方式打开文件[^从头读写]
w 写入方式打开文件[^从头读写,如果文件存在则删除,不存在则创建] w
w+ 读写方式打开文件[^从头读写,如果文件存在则删除,不存在则创建]
a 写入方式打开文件[^从末尾读写,如果文件存在则删除,不存在则创建] a
a+ 读写方式打开文件[^从末尾读写,如果文件存在则删除,不存在则创建]
x 创建并以写入方式打开文件[^从头读写,如果文件存在则删除,不存在则创建] x
x+ 创建并以读写方式打开文件[^从头读写,如果文件存在则删除,不存在则创建]
b 二进制模式,主要用于连接在其他模式后面[^Windows 区分、Linux/UNIX不区分。如果文件系统能够区分二进制文件和文本文件,则需要使用到此选项]
打开文件
fopen()

在PHP中主要使用fopen()函数打开文件,而fopen()函数可支持打开本地文件和以URL形式读取文件。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = fopen("l.php", "r+");
if ($one) {
echo "打开成功";
} else {
echo "打开失败";
}
?>
</body>
</html>
URL fopen()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$URL_open = fopen("http://clockshan.cn", "r");
if ($URL_open) {
echo "打开成功";
} else {
echo "打开失败";
}
?>
</body>
</html>
关闭文件
fclose()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$open = fopen("l.php", "w");
if (fclose($open)) {
echo "关闭成功";
} else {
echo "关闭失败";
}

?>
</body>
</html>

文件写创建与操作

创建文件
fopen()

在PHP中没有指定的创建文件函数,一般使用fopen()函数加文件模式(**”w”、”w+、“a”、”a+“**)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = fopen("deme.txt", "w");
if ($one) {
echo "创建成功";
} else {
echo "创建失败";
}
?>
</body>
</html>
文件写入
fwrite()

fwrite()函数可以向文件写入内容[^在文件已经打开的前提下。文件关闭后则不进行写入],由于UTF-8中文字符一个占两个字节,所以显示写入字节数为15

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$dir = fopen("demo.txt", "w+");
$write = fwrite($dir, "你好世界!");
if ($write) {
echo "写入成功";
echo "写入字节数为:",$write;
fclose($dir);
} else {
echo "文件写入失败";
}
?>
</body>
</html>
文件读取
fread()

fread()函数可以用于读取文件中的内容,在PHP中,fread()函数可以指定最大字节数,默认最大取值为8192

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$data = fopen("deme.txt", "r");
$one = ""; // 初始化为空
while (!feof($data)) {
$dataone = fread($data, 8192);
$one = $dataone;
}
echo $one;
fclose($data);
?>
</body>
</html>
file()

file()函数可以用于将整个文件读取到数组之中:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$wire = file("deme.txt");
foreach ($wire as $key) {
echo $key;
}
?>
</body>
</html>
readfile()

readfile()函数主要用于输出文件内容到浏览器之中,如:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "deme.txt";
$data = readfile($file);
echo "<br>";
echo "|- 当前字节数为",$data;
?>
</body>
</html>
fpassthru()

fpassthru()函数可以将指定的文件指针从当前未知读取到EOF(文档结尾),并把结果输出到缓冲区。使用fpassthru()函数需要先打开文件流、并将参数传递给fpassthru()函数,并到标准输出:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$name = "deme.txt";
$data = fopen($name, "r");
$num = fpassthru($data);
echo "<br>";
echo "读取字节数为:",$num;
fclose($data);
?>
</body>
</html>
file_get_contents()

file_get_contents()函数可以将整个或部分文件内容读取到一个字符串值中,整个执行过程共调用:fopen = 开启 、fread = 读取 、fclose = 关闭:

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$filename = file_get_contents("deme.txt");
echo $filename;
?>
</body>
</html>
读取EOF数据

EFO是(“资料源无更多资料获取,End Of File”),在操作系统之中主要表示当前源无更多资料获取所以在此表达含义为”最后一行数据:“

fgets()

fgets()函数的作用是可以读出一行文本逐一进行输出,而不像上述函数一样整合为一行进行输出[^默认的长度为1024个字节],如:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = fopen("deme.txt", "r");
if ($file) {
while (!feof($file)) {
$bufer = fgets($file);
echo $bufer,"<br>";
}
fclose($file);
}
?>
</body>
</html>
fgetss()

fgetss()函数的主要作用与fgets()作用基本相同,也是从文件指针处读取一行数据,fgetss()会尝试格式化HTML、Javascript、php等代码输出[^图1为fgetss()函数输出,图二为fgets函数输出。];

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = fopen("deme.txt", "r");
if ($file) {
while (!feof($file)) {
$bufer = fgetss($file);
echo $bufer,"<br>";
}
fclose($file);
}
?>
</body>
</html>
删除文件

在php之中,可使用unlink()函数进行删除不需要的文件,如果删除成功则返回TRUE、否则删除失败则返回FALSE;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1593173883_1490.gif";
// 删除文件
unlink($file);

// 检测文件是否存在
if (file_exists($file)) {
echo "文件存在";
} else {
echo "文件不存在";
}
?>
</body>
</html>
复制文件
copy()

PHP开发语言主要使用copy()来进行文件的复制:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1593173883_1490.gif";
$filedst = "D:/Program Files (x86)/phpStudy/WWW/text/one.gif";
if (copy($file, $filedst)) {
echo "文件复制成功!";
}
?>
</body>
</html>
移动和重命名文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$file = "D:/Program Files (x86)/phpStudy/WWW/text/1593173883_1490.gif";
$filedst = "D:/Program Files (x86)/phpStudy/WWW/text/two.gif";
if (rename($file, $filedst)) {
echo "重命名成功";
} else {
echo "重命名失败";
}
?>
</body>
</html>
第一个字符
fgetc()

fgetc()函数主要用于从文件开头到文件结尾处进行输出,所以与上述fgetss()、fgets()函数输出差不多:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$data = fopen("deme.txt", "r");
while (!feof($data)) {
$char = fgetc($data);
echo ($char == "\n"?'<br>':$char);
}
?>
</body>
</html>
ID DA FA
mdkir() 创建目录 目录
rmdir() 删除目录
getcwd() 获取当前所在目录
chdir() 是指当前所在的工作目录[^即指定目录]
opendir() 打开句柄
closedir() 关闭句柄
raddir() 读取目录内容
scandir() 获取指定的目录和文件
fopen() 打开文件[^fopen(URL)支持读取URL形式文件,fopen()可以搭配文件模式进行创建文件] 文件打开于关闭[^含创建]
fclose() 关闭文件
fwrite() 文件写入 文件读取
fread() 文件读取
file() 将整个文件读取到数组
readfile() 输出文件到浏览器中
fpassthru() 从指定文件指针中从开头读取到EOF
file_get_contents() 可以将整个或部分文件内容读取到一个字符串值中[^fopen = 开启 、fread = 读取 、fclose = 关闭]
fgets() 读出一行文本逐一进行输出,而不像上述函数一样整合为一行进行输出[^默认的长度为1024个字节] 读取EOF数据
fgetss() fgetss()函数的主要作用与fgets()作用基本相同,也是从文件指针处读取一行数据,fgetss()会尝试格式化HTML、Javascript、php等代码输出[^图1为fgetss()函数输出,图二为fgets函数输出。];
fgetc() 从文件的开头到结尾处进行输出[^所以与上述fgetss()、fgets()函数输出差不多]
unlink() 删除文件 文件删除
copy() 复制文件 文件复制
rename() 文件重命名 重命名文件

PHP 时间与日期

在PHP开发语言之众,PHP为用户提供了大量的日期和时间的相关函数,利用这些函数可以方便的获得当前的日期和时间,也可以生成一个指定的时间戳等方式输出。

时间戳是什么

时间戳即UNIX时间戳,在大多数UNIX系统中,保存当前的前日期和时间的方法是格林尼治时间[^格林尼治标准时间],而格林尼治时间是从1970年1月1日零点起到当前此刻的秒数,以32为整列表示。1970年1月1日零时起也即称之为UNIX纪元,在Windows系统中也可以使用UNIX时间戳,如果时间是在1970年以前或2039年以后,处理的事件将会发生错误。

时间转换为时间戳

strtotime()

如果用字符串表达的日期和事件转化为时间戳形式,即可使用**strtotime()**函数:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
echo strtotime('2020-10-27'),"<br>";
echo strtotime('2020-10-27 9:16:51'),"<br>";
echo strtotime('October 27, 2020');
?>
</body>
</html>
mktime()
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$time = mktime(9,26,55,10,27,2020); // 9时25分55秒,2020年10月27日
print_r($time);
?>
</body>
</html>

获取当前时间

在PHP开发语言之中,最常用的则是日期和时间函数即date()函数,可该函数的作用是我将时间戳按照只当的字符来显示具体的时间信息:

time()

time函数和data()函数有一定的区别,time()函数主要的作用就是和将时间戳转化为具体的日期和时间字符串如:

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
echo time(); // 输出当前时间戳
?>
</body>
</html>
date()
date()函数表
ID DA FA
d 当前月份的第几天 月份
j 月份中的第几天(没有前导零)
S 每月天数后面的英文后缀,两个字符标识[^如:st、nd、rd、th]
F 月份[^完整的文本格式(January)]
m 数字表示月份[^01~012]
M 三个字母缩写表示月份[^Jan]
n 数字表示月份,没有前导0[^1~12]
t 给定月份所应有的天数[^28~31]
D 星期中的第几天(用字母标识) 星期
l [^小写L] 星期几
w 星期中的第几天,数字显示[^0=星期天,6星期六]
z 年份中的第几天 年份
L 是否时闰年[^如果是闰年为1,则返回为0]
Y 数为数字表示完整年份[^如2020、2021]
y 二位数年份表示[^20]
a 小写的上午和下午值[^am、pm] 上午and下午
A 大写的上午和下午值[^AM、PM]
g 小时,12小时格式没有先导0[^1~12] 小时
G 小时,24小时格式,没有前导零[^0~24]
h 小时,12小时格式,有前导零[^01~12]
H 小时,24小时格式,有前导零[^00~23]
i 有前导零的分钟数[^00~59] 分钟
s 秒数,有前导零[^00~59]
U 从UNIX纪元至今的秒数[^即time秒数]
date() 输出当前时间
1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
echo date('Y 年 n 月 j 日 g 时 i 分 s 秒 A');
?>
</body>
</html>
date() 设置时区

data()系统默认的时格林尼治标准时间,所以显示的时间也许会和当前的时间有一定的差别,可通过date_default_timezone_set函数进行设置时区。Asia/Chongqing(重庆时间)Asia/Shanghai (上海时间),Aisa/Urumqi(乌鲁木齐),其北京时间可直接使用“PRC”

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
date_default_timezone_set('PRC');
echo "北京时间","<br>";
echo date('Y 年 n 月 j 日 g 时 i 分 s 秒 A');
?>
</body>
</html>
ID DA FA
strtotime() 字符串表达的日期和事件转化为时间戳 时间转换为时间戳
mktime() 字符串表达的日期和事件转化为时间戳
time() 时间戳转化为具体的日期和时间字符串 获取当前时间
date() 输出当前时间
设置时区
Asia/Chongqing 重庆时间 date_default_timezone_set
Asia/Shanghai 上海时间
Aisa/Urumqi 乌鲁木齐
PRC 北京时间

PHP 变量的创建

基本格式

在PHP中,变量通常以下面形式进行,如

1
$变量名;

例如:

1
$data = "Hello,world!";			// 字符串类型变量

访问变量

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
</head>
<body>
<?php
$data = "Hello,world!";
echo "<script>";
echo "alert('$data')";
echo "</script>";
?>
</body>
</html>

PHP 字符串操作与参数

PHP 字符串是在语言中相当重要的一个操作部分,程序传递给用户的可视化信息即为大部分靠字符串来实现的。

echo() 与 print()

在字符串中主要有echo and print,两个函数,而两个函数之间都是不同功能的,二者存在一定的区别。这就比如print具有一个返回值[^返回值为1],而echo没有返回值,所以echo 比 print函数要快一点,而print与echo的另一个区别就是,echo函数可输出多个字符串,而print则不行:

print
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$one = print "";
echo "$one";
?>
</body>
</html>
echo
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
echo "One","Two","Three";
print "One","Two","Three"; // Parse error: syntax error, unexpected ',' ……
?>
</body>
</html>

字符串格式化

printf()

printf()函数可以将一个通过替换值简历的字符串输出到格式化字符串中,而格式化字符串中的每一个替换标记都有一个百分号(%)组成,,后面可能有一个填充字符。字符串的类型说明符为“s”

字符串
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "Hello";
printf ("%s\n",$one);
printf ("%10s\n",$one);
printf ("%010s\n",$one);
?>
</body>
</html>
数值
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = 10;
printf("%d",$one);
?>
</body>
</html>

字符串操作函数

计算字符串个数
strlen()

serlen()函数主要用于计算字符串的长度,当需要计算字符串数目时,可通过strlen()函数进行计算。需要注意的是,当字符串是中文时,则一个中文占2个字节,而英文则占1个字节。

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "Hello,world";
echo strlen($one);
?>
</body>
</html>
字符串大小写
小写转换(strtolower)
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "Hello,world";
echo strtolower($one);
?>
</body>
</html>
大写转换(strtoupper)
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "Hello,world";
echo strtoupper($one);
?>
</body>
</html>
句子首字母大写(ucfirst)!
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "hello,world";
echo ucfirst($one);
?>
</body>
</html>
首字母开头大写(ucwords)
1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
echo ucwords("str int hello");
?>
</body>
</html>

字符串裁剪

trim

trim()函数主要将两边的多余空白字符去掉

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = " Hello ";
echo trim($one);
?>
</body>
</html>
ltrim

Itrim()函数主要删除左边相同的字符串内容,而右边可使用rtrim()函数实现。

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "HHHHHellohH";
echo ltrim($one,"H");
?>
</body>
</html>
rtim
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "HHHHHellohH";
echo rtrim($one,"H");
?>
</body>
</html>

字符串的查找与替换

字符串查找
strstr

查找字符串,如需要查找“el”,完整语句是“Hello”,则输出ello

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "Hello";
echo strstr($one, "el");
?>
</body>
</html>
strstr …… if
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$one = "Hello";
$two = "el";
if (strstr($one, $two)) {
echo "包含el";
} else {
echo "不包含el";
}
?>
</body>
</html>
字符串替换
str_replace
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$str = "Hello you";
$replace = "Sun";
$end = str_replace("you", $replace, $str);
echo "$end";
?>
</body>
</html>
多对一替换
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$tit = "Hello is world";
$arry = array("e","o","i","s");
echo str_replace($arry, "", $tit);
?>
</body>
</html>
substr_replace
1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
echo substr_replace("abcdefd", "AB", 3);
?>
</body>
</html>

3,3

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
echo substr_replace("abcdefd", "AB", 3,3);
?>
</body>
</html>

字符串比较

在实际的生活之中,经常可以发现通过姓氏笔画或拼音顺序来个多人或多个标题进行排序。而在程序设置中,由字母和数组促成的字符串,同样可以按照指定的规划来进行排序。而常见的字符串比较的函数有:string() 、strcasecmp()、strncmp()、strncasecmp()

如果$one比$two大,则他们都将返回大于0的整数。如果$one比$two小,则返回小于0的整数,再或者两者相等,则返回0

strcmp

strcmp()函数主要用于区分大小写的字符串比较

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
echo strcmp("abcd", "abcD");
?>
</body>
</html>
strncasecmp

strncasecmp()函数和strcmp()函数一样,只不过strncasecmp()函数与strcmp()函数不同的是strncasecmp()函数不需要区分大小写

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
echo strnatcasecmp("abcd", "abcD");
?>
</body>
</html>
strcasecmp

strcasecmp()函数主要用于不区分大小写的比较

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
echo strcasecmp("abcd", "abce");
?>
</body>
</html>
strncmp

strncmp()函数主要用于比较字符串的一部分,一般从字符串的开头进行比较

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
echo strncmp("abcd", "abcdEFD", 4);
?>
</body>
</html>

字符串写HTML

在web开发语言之中,通常都有支持HTML的语句,比如JavaScript他就支持输出html语句,而在PHP之中,可通过htmlspecialchars()函数,把HTML的代码进行转换和存储

在htmlspecialchars()函数中,有两个参数分别为:

ID DA
ENT_COMPAT 默认只转换双引号
ENT_NOQUOTES 都不转换(双引号 )
ENT_QUOTES 转换单引号和双引号
htmlspecialchars
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "<a href='#'>go</a>";
echo htmlspecialchars($one);
?>
</body>
</html>
htmlspecialchars.ENT_NOQUOTES!
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charsets="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "<a href='#'>go</a>";
echo htmlspecialchars($one,ENT_NOQUOTES);
?>
</body>
</html>
HTML转特殊字符

使用htmlspecialchars_decode()函数可以将HTML字符串形式转换为HTML格式,与htmlspecialcharrs()函数相反。

特殊字符转换表
ID DA
& &amp;
&quot;
&#039;
< &lt;
> &gt;
输出一个超链接
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = htmlspecialchars_decode("&lt;a href='#'&gt;demo&lt;/a&gt;");
echo $one;
?>
</body>
</html>

字符串的加密

在PHP中,提供了cryot()函数,可完成PHP的加密功能,但cryot并不是最可靠的。目前最常用的加密函数可以使用md5()函数,可以将字符串转换成一个长为32位的字符串;

而通过cryout()与md5()之间的区别就是cryout()是随机生成的,每次执行时生成的密文都不一样。而在md5()函数中,明文转换为密文的32位字符串是固定的,所以可使用进行判断。

cryout
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "你好世界";
echo crypt($one);
?>
</body>
</html>
md5()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>dems</title>
</head>
<body>
<?php
$one = "你好世界";
if (md5($one) == "65396ee4aad0b4f17aacd1c6112ee364") {
echo "OK";
echo "<br>";
echo "当前md5值为:",md5($one);
}
?>
</body>
</html>

列子

简单的留言功能

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<form name="fone" method="post" action="">
<h3>请输入Email地址:</h3>
<input type="text" name="Email" size=30>
<h3>请输入留言信息</h3>
<textarea name="note" rows=10 cols=30></textarea>
<br><input type="submit" name="bone" value="提交">
<input type="reset" name="btwo" value="清空">
</form>
<?php
if (isset($_POST['bone'])) {
// 接收Email 和 Note
$Email = $_POST['Email'];
$note = $_POST['note'];

if (!$Email || !$note) {
// 判断是否取值
echo "<script>alert('Email地址和留言信息未填写或填写不完整!')</script>";
} else {
$arrayName = array("@" ,$Email );
if (count($arrayName) !=2) {
// 如果有两个@则报错
echo "<script>alert('Email地址格式错误1')</script>";
} else {
$username = $arrayName[0];
$netname = $arrayName[1];

if (strstr($username, ".")or strstr($username, ",")) {
// 如果 username 含有 "."、","则报错
echo "<script>alert('Email地址格式错误!2')</script>";
} else {
// 输出 "<" and ">" 符号
$strone = htmlspecialchars("<");
$strtwo = htmlspecialchars(">");

// 将字母句子第一个改为大写
$newonte = ucwords($note);

echo "<br>";
echo "用户".$strone.$username. $strtwo."您好!&nbsp;";
echo "您是".$netname."网友!<br>";
echo "您的留言是:<br>&nbsp;&nbsp;&nbsp;&nbsp;".$newonte."<br>";
echo "<hr>";
}
}
}
}
?>
</body>
</html>
ID DA FA
echo() 回应[^没有返回值] 输出函数
print() 打印[^返回值为1,比echo()慢]
printf() 字符串的格式化 输出函数
strlen() 计算字符串个数[^当字符串是中文时,则一个中文占2个字节,而英文则占1个字节。] 计算字符串个数
strtolower() 小写转换 大小写转换
strtoupper() 大写转换
ucfirst() 句子首字母大写
ucwords 首字母开头大写
trim() 将两边的多余空白字符去掉 字符串裁剪
ltrim() 要删除左边相同的字符串内容[^右边可使用rtrim()函数实现。]
rtim() 要删除右边相同的字符串内容[^左边可通过ltrim()函数实现]
strstr() 查找字符串[^如需要查找“el”,完整语句是“Hello”,则输出ello] 字符串查找
if……strstr() 查找是否包含某个字符串
str_replace() 替换字符串[^该函数支持多对一进行替换,即通过数组进行] 字符串替换
substr_replace() 通过索引替换
strcmp() 区分大小写的字符串比较 字符串比较
strncasecmp() 不区分大小写的比较
strcasecmp() 不区分大小写的比较
strncmp() 从字符串开头进行比较[^echo strncmp(“abcd”, “abcdEFD”, 4);]
字符串写HTML
ENT_COMPAT 默认只转换双引号 htmlspecialchars()
ENT_NOQUOTES 都不转换(双引号 )
ENT_QUOTES 转换单引号和双引号
HTML转特殊字符
& &amp;
&quot;
&#039;
< &lt;
> &gt;
cryout() 随机生成密文 加密字符串
md5() 使用md5进行加密

PHP 数组

数组是对大量数据进行组织和管理的主要和有效手段之一,许多信息都已数组作为数据的载体,经常需要使用数组进行处理数据。在PHP中,数组主要包含两个参数。

数组的创建与初始化和输出

Array 数组创建

array() 标准数组 (键名、键值)!
1
2
3
<?php
$arrayName = array("ONE" => "one", "TWO" => "two");
?>
array() 键值数组 (键值)!
1
2
3
<?php
$one = array(1,2,3,4);
?>
array() 省略键名 (省略键名+键值)!
1
2
3
<?php
$array = array('1' => 2, 2 => 4, 3 => 6,7,8);
?>

创建

变量创建数组 (compact)!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$a = 10;
$b = "one";
$c = array(1,2,3);
$array = compact("a","b","c");
print_r($array);
?>
</body>
</html>
两个键值创建一个数组 (array_combine)!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = array("one","two","three");
$two = array("ONE","TWO","THREE");
$three = array_combine($one, $two);
print_r($three);
?>
</body>
</html>
自动建立数组 (arr[n])!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arr[0] = "a";
$arr[1] = "b";
$arr[2] = "c";
print_r($arr);
?>
</body>
</html>
将数组赋值给指定变量 (list)!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$one = array("红","白","蓝","橙");
list($one,$two,$three,$four) = $one;
echo "$one";
?>
</body>
</html>

输出

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$array = array('1' => 2, 2 => 4, 3 => 6,7,8);
print_r($array);
?>
</body>
</html>
$array[“键名”];
1
2
3
4
<?php
$one = array("蓝" => "蓝色","白" => "白色","红" => "红色","绿" => "绿色");
echo $one["蓝"];
?>
$array[“键值”];
1
2
3
4
<?php
$one = array("红色","蓝色","绿色,","黑色","白色");
echo $one[0];
?>
输出数组中的所有键名 (array_keys) !
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arrayName = array('one' => 1,'two' => 2,'three' => 3);
$one = array_keys($arrayName);
print_r($one);
?>
</body>
</html>
输出数组中所有的键值 (array_values)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$arrayName = array('one' => 1,'two' => 2,'three' => 3);
$one = array_values($arrayName);
print_r($one);
?>
</body>
</html>
移除数组中重复的值 (array_unique)!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$arrayName = array('one' => 1,'one' => 1,'three' => 3);
$one = array_unique($arrayName);
print_r($one);
?>
</body>
</html>

键名和键值的操作

检查键值是否存在 (in_array)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arrayName = array('one' => 1,'two' => 2,'three' => 3);
if (in_array(1, $arrayName)) {
echo "存在键值1";
} else {
echo "不存在";
}
?>
</body>
</html>
检查键名是否存在 (!array_key_exists)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arrayName = array('one' => 1,'two' => 2,'three' => 3);
if (array_key_exists('one', $arrayName)) {
echo "存在键名";
} else {
echo "不存在键名";
}
?>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arrayName = array('one' => 1,'two' => 2,'three' => 3);
$key = array_search('1', $arrayName);
if ($key == NULL) {
echo "数组不存在";
} else {
echo "$key";
}
?>
</body>
</html>

array_search与上述方法不同,上述方法如果键值存在则返回true,不存在则返回false,而array_search则是根据键值是否存在,如果键值存在则返回键名,如果不存在则返回NULL

数组的遍历与输出

while 循环
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = array(1,2,3,4,5,6);
while (list($key,$value) = each($one)) {
echo "$value";
echo "<br>";
}
?>
</body>
</html>

while循环、list和each方法的结合使用可以实现对数组的遍历,list方法重要的作用是将数组中的键值赋值给变量。each方法主要作用是返回当前的键名和值(并将数组指针移到下一位)

foreach 循环
1
2
3
4
5
6
7
8
9
<?php 
$arrayName = array('one' => 'one','two' => 'two');
foreach ($arrayName as $value) {
# code...
}
foreach ($arrayName as $key => $value) {
# code...
}
?>

实例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = array('one' => 'ONE','two' => 'TWO','three' => 'THREE' );
foreach ($one as $value) { // 输出数组的键值
echo "$value";
echo "<br>";
echo "<br>";
}
foreach ($one as $key => $value) { // 输出数组的键名和键值
echo $key. "=>".$value. "<br>";
}
?>
</body>
</html>

function循环时专门用于遍历数组的循环,每次循环的同时,当前单元的值会被付给$value,并且将数组内部的指针向前移动一步.,然后第二次循环和第一次循环一样,只不过当前单元的键名也会在每次循环变量中赋值给 $key

数组的排序

升序
sort()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = array('a' => 1,'c' => 3,'b' => 2);
if (sort($one)) {
print_r($one);
}
?>
</body>
</html>

sort()函数不仅仅对数组进行了重新排序,同时还删除了原来数组的键名,并重新分配索引。

asort()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = array('c' => 'cccc', 'd' => 'ddddd','a' => 'aaaaaa','e' => 'eeee');
asort($one);
print_r($one);
?>
</body>
</html>

asort()函数与sort()函数不同,数组重新排序后仍然还保持着键名和键值之间的关联,而不像sort()被拆分。

ksort()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = array('f' => 'fffff', 'd' => 'dddd','a' => 'aaaa','g' => 'gggg');
ksort($one);
print_r($one);
?>
</body>
</html>

ksort()函数与asort()函数一样,对数组的键名进行重新排序,排序后的键名仍然与键值关联

降序

在PHP中,升序的函数都有一个对应的降序排序,主要是 rsort、arsort、krsort三个,分别对应sort、asort、ksort三个函数:

sort()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arrayName = array('c' => 'cccc','a' =>'aaaa','b' => 'bbbb');
rsort($arrayName);
print_r($arrayName);
?>
</body>
</html>
arsort()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arrayName = array('c' => 'cccc','a' =>'aaaa','b' => 'bbbb');
arsort($arrayName);
print_r($arrayName);
?>
</body>
</html>
krsort()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arrayName = array('c' => 'cccc','a' =>'aaaa','b' => 'bbbb');
krsort($arrayName);
print_r($arrayName);
?>
</body>
</html>
多数组排序
array_multisort()

array_multsiort函数可以一次对多个数组进行排序,或根据多个数组的一个或多个多个数组进行排序,如:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$one = array(3,5,2,4,1);
$two = array(6,7,8,9,10);
array_multisort($one,$two);
print_r($one);
echo "<br>";
print_r($two);
?>
</body>
</html>
数组的重新排序
shuffle()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$one = array(1,20); // 产生有序数组
foreach ($one as $value)
echo "$value"; // 输出有序数组
shuffle($one); // 打乱数组顺序
foreach ($one as $value) {
echo "$value"; // 输出新的数组顺序
echo "<br>";
}
?>
</body>
</html>

使用shuffle函数可以将数组按照随机的顺序进行排列,并删除原有的键名从而自动建立自动索引。

array_reverse()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$one = array('a' => 1,2,3,4,5);
$two = array_reverse($one,TRUE);
print_r($two);
?>
</body>
</html>

array_reverse()函数主要作用是将数组按照相反的顺序进行排序。如果array_reverse()函数的参数是TRUE则保留原来的键值,但为FALSE则为数组重新建立索引,而array_reverse()函数默认为FALSE;

自然排序
natsort()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<body>
<?php
$arrayName = array("data-2","data-1","data-3","data-4");
natsort($arrayName);
print_r($arrayName);
?>
</body>
</html>

自然排序,是指natsort函数对字母、数字、字符串进行排序,并保持源于的键/值的关联即称之为自然排序

例子
计算并根据分数进行排序和提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 html>
<html>
<head>
<meta charset="utf-8">
<title>demos</title>
</head>
<style type="text/css">
</style>
<body>
<?php
echo "<form method=post>";
for($i=1;$i<6;$i++) {
// 名字框的名字即数组名
echo "学生".$i."的分数为<input type=text name='stu[]'><br>";
}
echo "<input type=submit name=sumb value='开始提交'>";
echo "</form>";
echo "<br>";

if (isset($_POST['sumb'])) {
$sum = 0; // 总成绩初始化为0
$min = 0; // 分数小于60的人初始化为0
$stu = $_POST['stu']; // 取得所有分本框值并赋值给数组$stu
$num = count($stu); // 计算数组$stu元素的个数
echo "本次总共录入的成绩有:<br>";
}
foreach ($stu as $score) { // 循环遍历数组 $stu
echo $score."&nbsp;"; // 输出数组的接收值
$sum = $sum + $score; // 计算总成绩
if ($score < 60) { // 判断分数小于 60 的情况
$sco[$min] = $score; // 将分数小于60的值赋给数组$min
$min++; // 分数小于60的人数+1
}
}
rsort($stu);
echo "<br><hr>成绩由高到低的排名如下:<br>";

foreach ($stu as $valuetwo) {
echo $valuetwo."&nbsp;"; // 输出降序排列数据
echo "<br><hr>成绩低于60分的如下:<br>";
for ($min=0;$min < count('sco');$min++) // 使用for循环输出$sco数组
echo $sco[$min]."&nbsp;";
$average = $sum/$num; // 计算平均成绩
echo "<br><hr>总共平均分为:<br>$average"; // 输出平均成绩
echo "<hr>";
}
?>
</body>
</html>
ID DA FA
array_keys 输出数组中所有的键名 数值
array_values 输出数组中所有的数值
array_unique 移除数组中重复的值
in_array 检测键值是否存在
array_key_exists 检测键名是否存在
array_search 检测是否存在[^如果键值存在则返回键名,不存在则返回NULL]
sort() 数组的升序[^重新排序,同时删除原来的键名,重新分配索引] 排序的升序
asort() 数组的升序[^数组重新排序后仍然保持着键名与键值的关联]
ksort() 数组的升序[^对数组的键名进行重新排序,排序后仍然保持着键名与键值的关联]
sort() 数组的降序[^重新排序,同时删除原来的键名,重新分配索引] 排序的降序
arsort() 数组的降序[^数组重新排序后仍然保持着键名与键值的关联]
krsort() 数组的降序[^对数组的键名进行重新排序,排序后仍然保持着键名与键值的关联]
array_multisort() 一次对多个或一个数组进行排序 数组的多排序
shuffle() 数组的重新排序[^删除原有的键名从而自动建立索引] 数组的重新排序
array_reverse() 将数组按照相反的顺序进行排序[^如果参数为“TRUE”则保留原来的键值,但为“FALSE”参数则重新建立索引,默认为FALSE]
natsort() 自然排序[^对字母、数字、字符串进行排序,并保持原来的键值关联即称之为“自然排序”] 数组的自然排序
list List主要的作用实现数组的循环遍历 循环

PHP 文件访问

在PHP语言之中,常用的有四种文件访问方法,分别为**”include“、”require“、”include_once“、”require_once”**四种,使用方法如下:

include

indexef.php

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
$one = "Hello,";
$two = "World!";
?>
</body>
</html>

index.php

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
include 'indexef.php';
echo "$one $two";
?>
</body>
</html>

文件错误提示

require

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
require 'indexef.php';
echo "$one $two";
echo "<br>";
?>
</body>
</html>

错误提示

include_once!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
include_once 'indexef.php';
echo "$one $two";
echo "<br>";

?>
</body>
</html>

文件错误提示

require_once

1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>demo</title>
</head>
<body>
<?php
require_once 'indexef.php';
echo "$one $two";
?>
</body>
</html>
ID DA FA
include 用于访问文件[^one.php可以使用two.php的相关函数]
require 用于访问文件[^one.php可以使用two.php的相关函数]
include_once 用于访问文件[^one.php可以使用two.php的相关函数]
require_once 用于访问文件[^one.php可以使用two.php的相关函数]
📖 more posts 📖