


Example of using registry (registry) of zf framework_PHP tutorial
Easy to use
require_once("Zend/Loader .php");
Zend_Loader::loadClass("Zend_Registry");
$Arr = array
(
'host' => '127.0.0.1',
'username' => 'root',
'password' => '111',
'dbname' => 'test'
);
$Reg = new Zend_Registry($Arr);
echo 'Hostname:' . $Reg['host'] . "
";
echo 'Username:' . $Reg['username'] . "
";
echo 'Password:' . $Reg['password'] . "
";
echo 'Database:' . $Reg['dbname'] . "
";
echo "
";
Zend_Registry::set('table name','sanguo'); //SET assignment method, you can also assign the value to an array
echo Zend_Registry::get('table name '); //GET value method
?>
Using object mode and using set and get methods
>//Introducing Loader to automatically load the class
require_once("Zend/Loader.php");
//Loading the registry object class
Zend_Loader::loadClass("Zend_Registry");
/*------------------------------------------------ --------*/
//Perform registry operations in object mode
//Assign the resources of the instantiated registry object class to $Reg
$Reg = new Zend_Registry();
//Convert $Reg to object format
Zend_Registry::setInstance($Reg);
//Assign value to $Reg (registry assignment)
$Reg ->name = ' Zhang San';
$Reg ->sex = 'Male';
$Reg ->age = '18';
//Output after obtaining the static object.
$Reg = Zend_Registry ::getInstance();
echo "Name is:" . $Reg->name . "
";
echo "Gender is: " . $Reg->sex . "< br>";
echo "Age is:" . $Reg->age . "
";
/*----------------- ---------------------------------------*/
$Arr = array(' Name' => 'Zhang San','Age' => '18','Hobby' => 'Internet');
Zend_Registry::set('My',$Arr);
class Person
{
public function My()
{
echo "My name is:" . Zend_Registry::get('My')['Name'] . "
";
echo "My age is:" . Zend_Registry::get('My')['Age'] . "
";
echo "My hobbies are:" . Zend_Registry: :get('My')['Hobby'] . "
";
}
}
$Person = new Person();
$Person -> My() ;
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The Xbox app allows its users to play exciting games on their PC in case the console is not there. Users can connect their Xbox controller directly to the PC and start playing on their Windows PC. Sometimes the Xbox Wireless Controller cannot be removed from a user's Windows 11/Windows 10 laptop. There are a number of issues, the most prominent of which is users encountering "removal failed" issues when trying to remove gadgets. If you get a "Removal failed" error when removing your Xbox Wireless Controller, restart your computer. The most straightforward solution to common problems is to restart your Windows device. If you are restarting your computer

Some of our readers have recently reported that they received one of the Windows activation errors, such as the 0xC004D302 error code on their Windows PC, due to which certain features stopped working. This error occurs on computers running non-core versions of Microsoft Windows. It can be triggered when the trusted data store is reactivated. You can solve this problem by following this article. What causes the 0xc004d302 error in this article? Here are some potential reasons behind the 0xC004d302 Windows Activation Error Code: Fake or Incorrect Product Key – One of the most common reasons why you receive the 0xC004d302 error code is when you enter

Folder properties provide users with details such as creation date, folder name, size, etc. However, sometimes you may come across the Location tab in the properties of a Windows folder. So, we'll walk you through the steps to troubleshoot and re-enable it. Alternatively, you can check out our detailed guide on fixing folder access denied issue on Windows 11. Why can't I find the Location tab in the folder properties? There are several factors that can cause the Location tab to be missing in folder properties on Windows 11. Most notably: Folders don’t support moving – some folders support moving to another location, while others don’t. By default, moving from one location to another is supported

Removing a Printer on Windows 11 Completely removing a printer requires two things - removing the printer itself, and then removing the driver. There are several ways you can perform these operations on Windows 11. They are: Method 1: From Settings Perhaps the most common method, a printer can be easily removed from the Windows Settings application. Here's how to do it: Press Win+I to open Settings. Then click Bluetooth & Devices in the left pane. On the right, click Printers & Scanners. Click the printer you want to uninstall. Select Delete. When prompted, click Yes. Method 2: Use Device Manager to Remove Printer Drivers Device Manager lets you manage and remove Windows

Location services are an important feature for some applications on Windows, depending on the location of your system. So if you see the Location Services option grayed out on your system, you can't even toggle it manually. Usually, some system glitch causes this issue and you can easily fix it by following these simple solutions. Fix 1 – Adjust the registry You can adjust the registry to fix this greyed out location services issue. 1. Press the Win key and type "Registry". 2. Then, click "Registry Editor" to open the Registry Editor on your system. 3. You will delete a specific registry subdirectory. Usually, it won't affect your system at all. However, it is recommended that you perform a system backup. one. After opening the Registry Editor, click

If WDMyCloud is not showing up on the network in Windows 11, this can be a big problem, especially if you store backups or other important files in it. This can be a big problem for users who frequently need to access network storage, so in today's guide, we'll show you how to fix this problem permanently. Why doesn't WDMyCloud show up on Windows 11 network? Your MyCloud device, network adapter, or internet connection is not configured correctly. The SMB function is not installed on the computer. A temporary glitch in Winsock can sometimes cause this problem. What should I do if my cloud doesn't show up on the network? Before we start fixing the problem, you can perform some preliminary checks:

If you are a Windows user and want to disable the core parking functionality in your system, this article will guide you through the process. What is core parking? The core parking function is a power saving mechanism. It puts some of your processors into a sleep mode that doesn't perform any tasks and consumes very little or no power. This helps reduce energy consumption and therefore heat in the system. These cores are unparked when needed. Few users need to disable this feature, especially gamers. Disabling this feature will improve your system performance. Disable Windows Core Parking using Windows Registry Editor Step 1: Use Windows + R keys simultaneously to open the run prompt. Step 2: At the run prompt

How to Block Notifications on Windows 11 You can easily block notifications on Windows 11 by following the steps below. To block your notifications: Open the Start menu and select Settings. Alternatively, you can directly press Windows key + I to open Settings. When settings open, click System in the list on the left, then click Notifications on the right. On the following screen, turn off notification options. Exit the Settings application. Going forward, application and system notifications will stop showing on the desktop. However, it's worth noting that some apps have their own built-in notification settings. In this case, you'll need to disable notifications directly from the app - but this is rare. By turning off notifications in Settings, you will eliminate
