downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

NULL> <اشیا
[edit] Last updated: Fri, 24 Jun 2011

view this page in

Resource

یک resource یک متغیر ویژه است که مرجع تمام منابع را در خود دارد. منابع ساخته و توابع ویژه استفاده شده‌اند. پی‌نوشت را برای یک فهرست از تمام این توابع و مربوط به انواع resource است.

Note: نوع resource در PHP 4 معرفی شد

تابع get_resource_type() را ببینید.

تبدیل به resource

به عنوان متغیر resource جایگاه ویژه‌ای برای فایل‌های باز شده ٬ اتصالات پایگاه داده٬ توابع تصویر و همانند آنها به یک resource تبدیل شوند معنی ندارد.

آزاد کردن منابع

با تشکر از سیستم شمارش مرجع معرفی شده در PHP 4 و Zend Engine یک resource بدون مرجع بیشتر بصورت خودکار شناسایی می‌گردد و جمع‌آوری آشغال آن را آزاد می‌سازد. به این دلیل آزاد کردن منبع بندرت نیاز به عملکرد دستی است.

Note: پیوند‌های پایگاه داده دائمی استثنائی برای این قانون است. آنها توسط جمع‌آوری آشغال جمع نخواهند شد. بخش اتصالات دائمی را برای اطلاعات بیشتر ببینید.



add a note add a note User Contributed Notes Resource - [1 notes]
up
0
adrian dot dziubek at gmail dot com
4 years ago
I spent an hour trying to create mock setup for testing SQL queries. The explanation here, that a resource contains file handlers and therefore there is no sense in trying to create one is lame. Being unable to redefine functions, creating a fake resource was the second thing I tried to put test in place, but looking at the search results, I see I'm the first one to try... For me it looks like security by obscurity.

 
show source | credits | sitemap | contact | advertising | mirror sites