-
解析PHP比较运算符
[PHP教程] 2021-05-22 15:09:26 129人阅读
PHP 中的比较运算符如下表所示: 例子 名称 描述 $a == $b 等于 如果类型转换后 $a 和 $b 的值相等,则返回 TRUE,否则返回 FALSE $a === $b 全等 如果 $a 和 $b...[详细]
-
一篇文章告诉你PHP三元运算符
[PHP教程] 2021-05-22 15:08:57 149人阅读
如果条件expr1成立,则执行语句expr2,否则执行expr3。 示例代码如下: ?php $a = 10 ; $a % 2 == 0 ? print $a 是偶数! : print $a 是奇数! ; ? 运行结果如下...[详细]
-
PHP if else语句概念
[PHP教程] 2021-05-22 15:06:22 135人阅读
【示例】 定义一个数组,使用 if 语句判断这个数字是不是偶数,代码如下所示: ?php $num = 34 ; if ( $num % 2 == 0 ) { echo $num = . $num . , 是偶数! ; }...[详细]
-
PHP switch case语句详解
[PHP教程] 2021-05-22 15:05:32 103人阅读
在使用 switch 语句时应该注意以下几点: 和 if 语句不同的是,switch 语句后面表达式的数据类型只能是整型或字符串,不能是 bool 型。通常这个表达式是一个变量...[详细]
-
PHP设计模式之单例模式原理与实现方法分析
[PHP教程] 2021-05-22 04:36:35 150人阅读
本篇章节讲解PHP设计模式之单例模式原理与实现方法。供大家参考研究具体如下: 一、什么是单例模式 作为对象的创建模式,单例模式确保某一个类只有一个实例,并且对外提供这个全局实例的访问入口。它不会创建实例副...[详细]
-
PHP receiveMail实现收邮件功能
[PHP教程] 2021-05-22 04:27:27 172人阅读
用PHP来发邮件,相信大家都不陌生,但读取收件箱的话,接触就少了,这次总结下自己的经验,希望可以帮助大家. 注意: 1.PHP读取收件箱主要是利用imap扩展,所以在使用以下方法前,必须开启imap扩展模块的支持. 2.此方法支持...[详细]
-
PHP分享图片的生成方法
[PHP教程] 2021-05-22 04:23:18 99人阅读
最近工作需求需要生成分享图片,最初用js的html2canvas截图插件各种问题,后来干脆PHP的PG库在后台生成图片,很愉快的解决了各种问题,我们要实现的效果如下图: 假设代码中用到的资源文件夹在当前code_png目录下: ...[详细]
-
php-fpm添加service服务的例子
[PHP教程] 2021-05-22 04:18:33 128人阅读
nginx通过FastCGI运行PHP比Apache包含PHP环境有明显的优势,最近有消息称,PHP5.4将很有可能把PHP-FPM补丁包含在内核里,nginx服务器平台上运行PHP将更加轻松,下面我们就来看一篇php-fpm平滑启动并配置服务例子。 我的p...[详细]
-
PHP使用Curl实现模拟登录及抓取数据功能示例
[PHP教程] 2021-05-22 04:16:55 88人阅读
本篇章节讲解PHP使用Curl实现模拟登录及抓取数据功能。供大家参考研究具体如下: 使用PHP的Curl扩展库可以模拟实现登录,并抓取一些需要用户账号登录以后才能查看的数据。具体实现的流程如下(个人总结): 1. 首先...[详细]
-
PHP获取文件扩展名的常用方法小结【五种方式】
[PHP教程] 2021-05-22 04:15:52 184人阅读
本文实例总结了PHP获取文件扩展名的常用方法。供大家参考研究具体如下: 这是我应聘实习时遇到的一道笔试题: 使用五种以上方式获取一个文件的扩展名。 要求:dir/upload.image.jpg,找出 .jpg 或者 jpg , 必须使用...[详细]
- 这篇文章主要介绍了Laravel 5.0 发布 新版本特性详解,...[详细]
- 计算两个日期之间的时间差需要先把两个日期转换成纪元...[详细]
- 初步使用面向对象程序设计,要掌握的就是使用面向对象...[详细]
- 每个 PHP 数组内部都有一个指针,该指针指向数组的某...[详细]
- 因为 PHP 是一个 Web 编程语言,在编程过程中难免会遇...[详细]
- PHP 中提供了 return 语句来返回函数的运行结果,其语...[详细]
- final 关键字的作用如下: 使用 final 修饰的类,不能...[详细]
- 在使用 switch 语句时应该注意以下几点: 和 if 语句...[详细]
- 这篇文章主要给大家介绍了关于PHP替换Word中变量并导...[详细]
- 这篇文章主要介绍了PHP常量DIRECTORY_SEPARATOR原理及...[详细]