九月 17th, 2009
WP-Syntax使用(Wordpress 语法高亮插件)
下载地址:http://wordpress.org/extend/plugins/wp-syntax/
菜单:插件->添加新插件->激活
使用方法:
在html里面手工加入:<pre lang=”php”> </pre> 然后在中间些代码就ok了
if ( !defined('WP_MEMORY_LIMIT') ) define('WP_MEMORY_LIMIT', '32M'); if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) @ini_set('memory_limit', WP_MEMORY_LIMIT); set_magic_quotes_runtime(0); @ini_set('magic_quotes_sybase', 0); /** * Turn register globals off. * * @access private * @since 2.1.0 * @return null Will return null if register_globals PHP directive was disabled */ function wp_unregister_GLOBALS() { if ( !ini_get('register_globals') ) return; if ( isset($_REQUEST['GLOBALS']) ) die('GLOBALS overwrite attempt detected'); // Variables that shouldn't be unset $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix'); $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) $_SESSION : array()); foreach ( $input as $k => $v ) if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) { $GLOBALS[$k] = NULL; unset($GLOBALS[$k]); } } wp_unregister_GLOBALS(); // ....
又如:
# -*- coding: gbk -*- import MySQLdb conn = MySQLdb.Connection('127.0.0.1', 'root', '.....', 'test'); cur = conn.cursor() cur.execute('select * from aa') #cur.scroll(0) row = cur.fetchone() print row[0]
