Home > Backend Development > PHP Tutorial > How to set php abbreviation function

How to set php abbreviation function

藏色散人
Release: 2023-04-07 20:52:01
forward
3171 people have browsed it

Introduction to the usage environment of this tutorial

Server: Ubuntu 18.04 LTS

Database: Mariadb 10.1.34 (Mysql)

Language version: php 7.3

Local side: MacOS High Sierra

Enabling php abbreviations can save some writing, although it is not much different, but if there are more scripts, it will look easier to identify

For example, you need to add php at the beginning of the php script

<?php
    // do..
?>
Copy after login

After turning on the abbreviation, you will not need it

<?
    // do..
?>
Copy after login

And when you want echo information

<?php echo $data; ?>
Copy after login

After turning on the abbreviation

<?=$data;?>
Copy after login

Isn’t it much cleaner!

There may be other abbreviations, but I didn't find them~

Just note that if you use crontab to run a php script, the script still needs to have

Then start setting the abbreviation function

Go to the php version you are currently using, there will be an apache2 folder inside

Go directly to nano and enter php.ini

$ nano /etc/php/7.X/apache2/php.ini
Copy after login

Then find short_open_tag and change it to On

short_open_tag = On
Copy after login

Don’t forget to reload

$ service apache2 reload
Copy after login

Recommended: PHP tutorial

The above is the detailed content of How to set php abbreviation function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template