求救:Fatal error: Call to undefined function: sem_get() in /home/yjj/public_html/test/index.php on line 7 xizi2002 (☆☆戏☆子☆☆) ☆你是想送点分给我们吧!好啊。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 赫赫,怎么会有这种错误提示呢?这个函数是php3.06-php4都可以用的。 晕倒,不是,我真的出现了这种情况,在别人的服务器上也出现了这种情况,很奇怪呵.具体程序index.php<? class SharedMem{ var $SemaphoreID; var $SharedMemID; var $VarIndexes; function SharedMem(){ $this->SemaphoreID = sem_get(1000,1,0600); $this->SharedMemID = shm_attach(2000,65535,0600); sem_acquire($this->SemaphoreID); $this->VarIndexes = @shm_get_var($this->SharedMemID,0); if(empty($this->VarIndexes)){ $this->VarIndexes = array(); shm_put_var($this->SharedMemID,0,$this->VarIndexes); } sem_release($this->SemaphoreID); } //取出存在共享内存中的某变量,返回false表示共享内存中无该变量 function read($name){ if(!isset($this->VarIndexes[$name])) return false; $GLOBALS[$name] = shm_get_var($this->SharedMemID,$this->VarIndexes[$name]); return true; } //将指定变量存入共享内存 function save($name){ if(!isset($this->VarIndexes[$name])){ $this->VarIndexes[$name] = count($this->VarIndexes)+1; shm_put_var($this->SharedMemID,0,$this->VarIndexes); } shm_put_var($this->SharedMemID,$this->VarIndexes[$name],$GLOBALS[$name]); } } ?> test.php<? include("index.php"); $test = new SharedMem(); $abc = '123'; $test->save('abc'); unset($abc); $test->read('abc'); print $abc; ?> 演示:http://www.yu.40it.com/test/test.php php 如何显示所属类别 phpwind群发邮件的问题 include_once的时候出现莫名其妙的回车换行 如何防止打开页面自动下载 PHP程序 语言是utf-8 JS弹出对话框 出现乱码 empty怎么样判断多个变量 菜鸟请教:为什么我在php.ini-dist中修改了register_globals = On并重起,但是用phpinfo()显示出来的register_globals依然是off? 一个关于session的奇怪问题 关于php和短信等问题,望大家帮帮忙,急呀!!! 求助!数据库与数组问题! 手机短信 php有没有直接调用打印命令的语句
index.php
<?
class SharedMem{
var $SemaphoreID;
var $SharedMemID;
var $VarIndexes;
function SharedMem(){
$this->SemaphoreID = sem_get(1000,1,0600);
$this->SharedMemID = shm_attach(2000,65535,0600);
sem_acquire($this->SemaphoreID);
$this->VarIndexes = @shm_get_var($this->SharedMemID,0);
if(empty($this->VarIndexes)){
$this->VarIndexes = array();
shm_put_var($this->SharedMemID,0,$this->VarIndexes);
}
sem_release($this->SemaphoreID);
} //取出存在共享内存中的某变量,返回false表示共享内存中无该变量
function read($name){
if(!isset($this->VarIndexes[$name])) return false;
$GLOBALS[$name] = shm_get_var($this->SharedMemID,$this->VarIndexes[$name]);
return true;
} //将指定变量存入共享内存
function save($name){
if(!isset($this->VarIndexes[$name])){
$this->VarIndexes[$name] = count($this->VarIndexes)+1;
shm_put_var($this->SharedMemID,0,$this->VarIndexes);
}
shm_put_var($this->SharedMemID,$this->VarIndexes[$name],$GLOBALS[$name]);
}
}
?>
test.php
<?
include("index.php");
$test = new SharedMem();
$abc = '123';
$test->save('abc');
unset($abc);
$test->read('abc');
print $abc;
?>
演示:
http://www.yu.40it.com/test/test.php