自己写的兼容低于PHP 5.5版本的array_column()函数,5.5array_column
array_column 用于获取二维数组中的元素(PHP 5.5新增函数),但我们有时候需要在低版本的PHP环境中使用…
if( ! function_exists('array_column')) { function array_column($input, $columnKey, $indexKey = NULL) { $columnKeyIsNumber = (is_numeric($columnKey)) ? TRUE : FALSE; $indexKeyIsNull = (is_null($indexKey)) ? TRUE : FALSE; $indexKeyIsNumber = (is_numeric($indexKey)) ? TRUE : FALSE; $result = array(); foreach ((array)$input AS $key => $row) { if ($columnKeyIsNumber) { $tmp = array_slice($row, $columnKey, 1); $tmp = (is_array($tmp) && !empty($tmp)) ? current($tmp) : NULL; } else { $tmp = isset($row[$columnKey]) ? $row[$columnKey] : NULL; } if ( ! $indexKeyIsNull) { if ($indexKeyIsNumber) { $key = array_slice($row, $indexKey, 1); $key = (is_array($key) && ! empty($key)) ? current($key) : NULL; $key = is_null($key) ? 0 : $key; } else { $key = isset($row[$indexKey]) ? $row[$indexKey] : 0; } } $result[$key] = $tmp; } return $result; } }
下面是个在网上找的安装步骤,具体我也没再apache下配置过,
如果不想麻烦可以下个现成的组件,比如PHPnow,集成了apache+php+mysql+Zend Optimizer+eAccelerator需要配置的都集成好了,安装一下就成啦
当然是2003下好啦
要做到既可以在php4上运行,又可以在php5上运行,你需要有一个版本判断的功能
你可以这样:
if (version_compare( phpversion(), '5', ' include_once( 'php4.php' ) ;//php4的相关配置文件或调用函数
else
include_once( 'php5.php' ) ;//php5的相关文件或调用函数
}
这样在不同的环境下,就可以调用不同的文件,实现你的功能,不过具体要实现要复杂的多。
希望对你有帮助

Alat AI Hot

Undresser.AI Undress
Apl berkuasa AI untuk mencipta foto bogel yang realistik

AI Clothes Remover
Alat AI dalam talian untuk mengeluarkan pakaian daripada foto.

Undress AI Tool
Gambar buka pakaian secara percuma

Clothoff.io
Penyingkiran pakaian AI

Video Face Swap
Tukar muka dalam mana-mana video dengan mudah menggunakan alat tukar muka AI percuma kami!

Artikel Panas

Alat panas

VSCode Windows 64-bit Muat Turun
Editor IDE percuma dan berkuasa yang dilancarkan oleh Microsoft

Muat turun versi mac editor Atom
Editor sumber terbuka yang paling popular

SublimeText3 versi Cina
Versi Cina, sangat mudah digunakan

Dreamweaver Mac版
Alat pembangunan web visual

Hantar Studio 13.0.1
Persekitaran pembangunan bersepadu PHP yang berkuasa
