Home Backend Development PHP Tutorial 这段代码用PHP基准格式写应该是怎样的

这段代码用PHP基准格式写应该是怎样的

Jun 13, 2016 pm 01:19 PM
content name quot title

这段代码用PHP标准格式写应该是怎样的
在公用PHP文件里做了个判断,需要混排PHP和HTML,自己不会写,麻烦大家帮忙改写一下这段,用PHP的标准写法是怎样的:

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php if $id=1
{ 
    echo "<title> $row['p_name']; - 欢迎光临!
       <meta name="keywords" content="$row['p_name'];,关键字测试">
           <meta name="description" content="$row['p_name'];,描述测试"> 
          ";
}
else
{
     echo "<title>Welcome</title>
       <meta name="keywords" content="关键字测试">
           <meta name="description" content="描述测试"> 
          ";
}
?>

Copy after login


谢谢!!!

------解决方案--------------------
还是这样吧:
PHP code
<?php if( $id === 1 )
{ 
    echo "html
       <title> {$row['p_name']} - 欢迎光临!
       <meta name='\"keywords\"' content="\"{$row['p_name']},关键字测试\"">
       <meta name='\"description\"' content="\"{$row['p_name']},描述测试\""> ";
}
else
{
     echo "
       <title>Welcome</title>
       <meta name='\"keywords\"' content='\"关键字测试\"'>
       <meta name='\"description\"' content='\"描述测试\"'>";
}
?>
<br><font color="#e78608">------解决方案--------------------</font><br><?php <br />$title = ''; $keywords = ''; $description = '';<br>if($id==1){<br>	$title = $row['p_name'];<br>	$keywords = $row['p_name'];<br>	$description = $row['p_name'];<br>}?><br><title><?php echo $title;?></title><br><meta name="keywords" content="<?php echo $keywords;?>,关键字测试"><br><meta name="description" content="<?php echo $description;?>,关键字测试">
<br><font color="#e78608">------解决方案--------------------</font><br>- -  傻了,上面第一行应该是$title = 'Welcome' <div class="clear">
                 
              
              
        
            </div>
Copy after login
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

what does title mean what does title mean Aug 04, 2023 am 11:18 AM

Title is the meaning that defines the title of the web page. It is located within the tag and is the text displayed in the title bar of the browser. Title is very important for the search engine optimization and user experience of the web page. When writing HTML web pages, you should pay attention to using relevant keywords and attractive descriptions to define the title element to attract more users to click and browse.

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

What is the meaning of title in HTML What is the meaning of title in HTML Mar 06, 2024 am 09:53 AM

The title in HTML displays the title tag of the web page, which allows the viewer to know what the current page is about, so each web page should have a separate title.

How to add name to setup in Vue3 How to add name to setup in Vue3 May 13, 2023 am 09:40 AM

What is the use of name in Vue3? 1. Name needs to be defined when making recursive components. 2. The component can be cached with keep-aliveincludeexclude. 3. When Vue reports an error or is debugging, you can see the name of the component. Vue3 defines name1. It is automatically generated as long as the setup syntax sugar mode single file component is turned on in the script. The corresponding name option will be automatically generated based on the file name. For example, Tree.vue, then its name will be automatically generated by Tree. This has a drawback. If you want to modify the name, you need to modify the component name. If there is a place to import the component, you need to modify it together. 2. Open a script to define name

CSS content properties explained: content, counter, and quotes CSS content properties explained: content, counter, and quotes Oct 21, 2023 am 10:16 AM

Detailed explanation of CSS content attributes: content, counter and quotesCSS (cascading style sheets) is an integral part of front-end development. It can help us beautify web pages and enhance user experience. In CSS, there are some special properties that can be used to control the display of text content, including content, counter, and quotes. This article explains these properties in detail and provides specific code examples. 1. content attribute content attribute

What should I do if php cannot get the name? What should I do if php cannot get the name? Nov 24, 2022 am 09:56 AM

PHP cannot get the name because when the name and id values ​​of the form element are different, the browser cannot recognize it. The solution: 1. Check whether some form elements and frame elements use name; 2. Check only Elements that can be assigned ID but not name; 3. For multi-select box checkbox, you can use "join(',', $__POST['name'])" to form data.

Microsoft AI CEO says using open web content to train AI models isn\'t wrong Microsoft AI CEO says using open web content to train AI models isn\'t wrong Jun 30, 2024 pm 10:59 PM

In an interview with CNBC's Andrew Ross Sorkin, Microsoft AI CEO Mustafa Suleymanexpressed his understanding of web copyright law. Suleyman says that content that is accessible on the open web is "freeware," and anyone can copy it, reproduc

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题 不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题 Jun 13, 2016 am 10:15 AM

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。

See all articles