PHP development corporate website tutorial showing information about us

After we have learned how to operate users (add, delete, modify, check), it will be very simple to develop the following functions. Most of them are the same, except that the SQL statements are different, but the principles are basically similar.

Below Let’s take a look at the display of some information about us

$length) return mb_substr($str, $start, $length, $charset)."..."; else return mb_substr($str, $start, $length, $charset); }elseif(function_exists('iconv_substr')) { if ($suffix && strlen($str)>$length) return iconv_substr($str,$start,$length,$charset)."..."; else return iconv_substr($str,$start,$length,$charset); } $re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/"; $re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/"; $re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/"; $re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/"; preg_match_all($re[$charset], $str, $match); $slice = join("",array_slice($match[0], $start, $length)); if($suffix) return $slice."…"; return $slice; } ?>     展示关于我们的信息  
ID 标题 内容 操作
修改 删除

When the displayed content is too long, we need to intercept the length of the string

We have encapsulated the usage method Take a look at the code for the output content part below. Starting from 0, take 20

. Deletion and modification are also with id

Continuing Learning
||
$length) return mb_substr($str, $start, $length, $charset)."..."; else return mb_substr($str, $start, $length, $charset); }elseif(function_exists('iconv_substr')) { if ($suffix && strlen($str)>$length) return iconv_substr($str,$start,$length,$charset)."..."; else return iconv_substr($str,$start,$length,$charset); } $re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/"; $re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/"; $re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/"; $re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/"; preg_match_all($re[$charset], $str, $match); $slice = join("",array_slice($match[0], $start, $length)); if($suffix) return $slice."…"; return $slice; } ?> 展示关于我们的信息
ID 标题 内容 操作
修改 删除
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!