php初学者常见问题

1.绝对定位 absolute与fixed的区别

absolute:相对于父盒子进行定位
fixed:相对于屏幕进行定位php

2.经常使用属性

1.定义背景图片重复属性:background-repeat
2.定义背景图片位置属性:background-position:x% y%apache

3.php中Apache没法start问题解决方法

3614B202-0612-4a1b-B2F3-D80387EC6A79.png
这个问题比较常见, 一般是80、443端口被占用
解决方法:
点击Config按钮,能够看到有两个配置文件httpd.conf和httpd-ssl.conf;如今要根据端口号错误来更改apache的端口号app

80端口有问题,打开httpd.conf文件,找到设置端口的配置信息以下:

Listen: Allows you to bind Apache to specific IP addresses and/or
ports, instead of the default. See also the <VirtualHost>
directive.
.#
Change this to Listen on specific IP addresses as shown below to 
prevent Apache from glomming onto all bound IP addresses.ide

.#Listen 12.34.56.78:80
Listen 80
将上面两行的80改成81this

443端口有问题,打开httpd-ssl.conf文件,找到设置端口的配置信息以下:

.#
When we also provide SSL we have to listen to the 
standard HTTP port (see above) and to the HTTPS port
.#
Note: Configurations that use IPv6 but not IPv4-mapped addresses need two
      Listen directives: "Listen [::]:443" and "Listen 0.0.0.0:443"
.#
Listen 443
将上面两行的443改成444(可自定义)url

4.ThinkPHP自动调用的规则各个位置的含义

2016-07-02_57778a2d19ae8.png
尤为注意各个箭头所指的文件夹及其文件夹所在的位置spa

5.调用application\common\model文件夹下的数据模型文件名称与controller下url文件名称相同所致使网页error解决方法

产生error缘由:
例如将application\common\model文件夹下的Teacher.php文件中定义的Teacher类导入到当前文件。此时,因为导入的类名叫作Teacher,而后咱们本身的名字也叫作Teacher,命名发生冲突,计算机在识别时会出现识别混乱,致使网页没法达到预约效果。
解决方法:code

方法一:

1.在application根目录下的config.php 找到 controller_suffix 项,并配置为 true。
2.修改原来C层的文件名
Teacher.php -> TeacherController.php(同为控制器的Index.php,也要修改为IndexController.php)
因为sublime中class类名须要与文件名保持相同,因此class类名也须要改成TeacherControllerblog

方法二:

为导入的teacher文件起别名
(格式:文件名 as 别名 例如:Teacher as SmallTeacher 即把一个名称为Teacher的文件起了个别名:SmallTeacher )图片

方法一与方法二的本质区别: 方法一本质上是给controller下的文件更名字使二者易于区分方法二本质上是给导入的文件起别名,在用导入的文件时叫他别名而不叫他真正的名字,计算机识别时就可将二者区分。

相关文章
相关标签/搜索