我已經下載了dio extension-> php_dio.dll(版本5.2.6.6)並將其放入擴展名dir php,然後將extension = php_dio.dll放入php.ini中,然後重新啓動apache。我不能使用dio_extension php
中的phpinfo()顯示:see here
我在一些論壇,它是舊版本DIO擴展閱讀。
我試着運行this script:
<?php
// Create a stream context that configures the serial port
// And enables canonical input.
$c = stream_context_create(array('dio' =>
array('data_rate' => 115200,
'data_bits' => 8,
'stop_bits' => 1,
'parity' => 0,
'is_canonical' => 1)));
// Are we POSIX or Windows? POSIX platforms do not have a
// Standard port naming scheme so it could be /dev/ttyUSB0
// or some long /dev/tty.serial_port_name_thingy on OSX.
if (PATH_SEPARATOR != ";") {
$filename = "dio.serial:///dev/ttyS0";
} else {
$filename = "dio.serial://COM5";
}
// Open the stream for read only and use it.
$f = fopen($filename, "r+", false, $c);
if ($f) {
echo "Writing to port...\n";
fprintf($f,"Hello world\n");
echo "Reading from port...\n";
$data = fgets($f);
if ($data) {
echo $data;
}
fclose($f);
}
?>
,但我總是得到警告:的fopen(dio.serial:// COM5)[function.fopen]:未能打開流:沒有這樣的文件或目錄中
dio擴展不能在Windows中工作?或者我正在使用舊版本?
如果我使用舊版本,在哪裏可以找到更新版本的dio擴展。
在此先感謝。