<?phpif (! isset($wp_did_header)):if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {if (strpos($_SERVER['PHP_SELF'], 'wp-admin') !== false) $path = ''; else $path = 'wp-admin/';
require_once( dirname(__FILE__) . '/wp-includes/classes.php');require_once( dirname(__FILE__) . '/wp-includes/functions.php');require_once( dirname(__FILE__) . '/wp-includes/plugin.php');wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started.Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can <a href='{$path}setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress › Error");}$wp_did_header = true;require_once( dirname(__FILE__) . '/wp-config.php');wp();gzip_compression();require_once(ABSPATH . WPINC . '/template-loader.php');endif;?>
require_once( dirname(__FILE__) . '/wp-includes/classes.php');require_once( dirname(__FILE__) . '/wp-includes/functions.php');require_once( dirname(__FILE__) . '/wp-includes/plugin.php');wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started.Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can <a href='{$path}setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.", "WordPress › Error");}$wp_did_header = true;require_once( dirname(__FILE__) . '/wp-config.php');wp();gzip_compression();require_once(ABSPATH . WPINC . '/template-loader.php');endif;?>
现在该怎么理解好呢...
=
!isset($wp_did_header)?1:if ( !file_exists( dirname(__FILE__) . '/wp-config.php') )难道这样解释?
.....
endif;与
if (! isset($wp_did_header)) {
.....
}一样,只是书写格式不同而已!
....
endif;
是if() {...}的另外一种写法
echo "yep\n";
elseif ($bar);
echo "almost\n";
else;
echo "nope\n";
endif;
例 F-6. 移植:新的 if..endif 语法if ($foo):
echo "yep\n";
elseif ($bar):
echo "almost\n";
else:
echo "nope\n";
endif;
这个吗?
使用 if(); elseif(); else; endif; 这一系列复杂的语句无助于 PHP 3.0 解析器的效率。因此,语法改变为: 例 F-5. 移植:旧有 if..endif 语法if ($foo);
echo "yep\n";
elseif ($bar);
echo "almost\n";
else;
echo "nope\n";
endif;
例 F-6. 移植:新的 if..endif 语法if ($foo):
echo "yep\n";
elseif ($bar):
echo "almost\n";
else:
echo "nope\n";
endif;
注意,在所有的声明中分号均改为冒号,除了末尾的 endif 以外。
PHP 提供了一些流程控制的替代语法,包括 if,while,for,foreach 和 switch。替代语法的基本形式是把左花括号({)换成冒号(:),把右花括号(})分别换成 endif;,endwhile;,endfor;,endforeach; 以及 endswitch;。
<?php if ($a == 5): ?>
A is equal to 5
<?php endif; ?> 在上面的例子中,HTML 内容“A is equal to 5”用替代语法嵌套在 if 语句中。该 HTML 的内容仅在 $a 等于 5 时显示。 替代语法同样可以用在 else 和 elseif 中。下面是一个包括 elseif 和 else 的 if 结构用替代语法格式写的例子:
<?php
if ($a == 5):
echo "a equals 5";
echo "...";
elseif ($a == 6):
echo "a equals 6";
echo "!!!";
else:
echo "a is neither 5 nor 6";
endif;
?> 更多例子参见 while,for 和 if。
这是什么意思?
wp 2.2
也是用这个语法啊