PHP hack的使用方法是一个比较麻烦的过程。我们在这里给出的代码示例,希望能够作为大家在开发中的参考学习对象。这次讲的是使用PHP hack实现类似TAB VIEW的效果哦,的确麻烦些。#t#
PHP hack示例:
- }
- function tabs_start()
- {
- ob_start();
- }
- function endtab()
- {
- global $tabs;
- $text = ob_get_clean();
- $tabs[ count( $tabs ) - 1 ][ 'text' ] = $text;
- ob_start();
- }
- function tab( $title )
- {
- global $tabs;
- if ( count( $tabs ) > 0 )
- endtab();
- $tabs []= array(
- title => $title,
- text => ""
- );
- }
- function tabs_end( )
- {
- global $tabs;
- endtab( );
- ob_end_clean( );
- $index = 0;
- if ( $_GET['tabindex'] )
- $index = $_GET['tabindex'];
- ?>
- < table width="100%" cellspacing="0" cellpadding="0">
- < tr>
- < ?php
- $baseuri = $_SERVER['REQUEST_URI'];
- $baseuri = preg_replace( "/\?.*$/", "", $baseuri );
- $curindex = 0;
- foreach( $tabs as $tab )
- {
- $class = "tab";
- if ( $index == $curindex )
- $class ="tab-active";
- ?>
- < td class="< ?php echo($class); ?>">
- < a href="< ?php echo( $baseuri."?tabindex=".$curindex ); ?>">
- < ?php echo( $tab['title'] ); ?>
- < /a>
- < /td>
- < ?php
- $curindex += 1;
- }
- ?>
- < /tr>
- < tr>< td class="tab-content" colspan="< ?php echo( count( $tabs ) + 1 ); ?>">
- < ?php echo( $tabs[$index ]['text'] ); ?>
- < /td>
- < /table>
- < ?php
- }
- ?>
以上这一大段的代码就是有关PHP hack的具体实现方法。
标题名称:PHP hack的使用技巧详解
链接地址:http://www.shufengxianlan.com/qtweb/news14/415414.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联