Dynamic generation of php class based on URL parameters
source link: https://www.codesd.com/item/dynamic-generation-of-php-class-based-on-url-parameters.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Dynamic generation of php class based on URL parameters
I have an image generating class and a number of sub classes inherited from this. Each sub class generates a different image. I would like to pass the class to generate (or some sort of identifier) in the URL. EG: www.mysite.com/image.php?class=image002 In image.php I could read the class name from the URL, compare this to my database to find the class, then include that class file and generate. I feel that this is not the correct way of doing it. Are there better ways?
Apparently there is nothing wrong with your passing values into url that way especially if these image names are unique and are not sensitive data. unique so that you dont execute the same class with two different images. but you could just append/prepend a random string to the image value. also as hamza said hope they aren't php classes
Related Articles
Dynamic calling of PHP class methods
How do I get a specific response (data logging) from a PHP script based on the parameters sent to this script?
Calling PHP classes from a URL
Dynamic route to Flask actions based on URL
Dynamic creation of a query based on sending parameters to a controller
Choice of classes based on given parameters
What is the best way to create a Java Servlet or JSP that optionally includes content based on URL parameters
Oracle Stored Procedure - dynamically generate a selection statement based on optional parameters
Creating dynamic PHP code based on the MySQL column data types
Hide the php extension and URL url parameters using htaccess godaddy linux hosting
Can I set a PHP class property from an existing variable?
How to create an instance of an existing PHP class in a secure and dynamic way?
Is there an option for dynamic extension of the class in PHP?
ASP.NET MVC Sets the CSS class dynamically to list the item based on the route
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK