Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Sprawdzanie wykorzystania $_GET i _$POST
ignition
post
Post #1





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 14.06.2004

Ostrzeżenie: (0%)
-----


Zrobiłem pseudo klasę która podstawiana jest pod $_GET i $_POST, aby sprawdzić które zmienne zostały wykorzystane ( potrzebne mi to jest do cache stron )
  1. <?php
  2.  
  3. class exd
  4. {
  5. public $vars;
  6. protected $checkVars;
  7. protected $typeHttpVars;
  8.  
  9. function __construct( $type, $args = '' )
  10. {
  11. $this->typeHttpVars = $type;
  12. $this->vars = $args;
  13. $this->checkVars = $args;
  14. }
  15.  
  16. function __get( $name )
  17. {
  18. unset( $this->checkVars[&#092;"$name\"] );
  19. return $this->vars[&#092;"$name\"];
  20. }
  21.  
  22. function __set( $name, $value )
  23. {
  24. $this->vars[&#092;"$name\"] = $value;
  25. }
  26.  
  27. // czy nie jest wykorzystany
  28. function isUntapped()
  29. {
  30. if( empty( $this->checkVars ) ) return true;
  31. return false;
  32. }
  33. }
  34.  
  35.  $_POST = new exd( post, $_POST );
  36.  $_GET = new exd( get, $_GET );
  37.  
  38. ?>

Do zmiennej dostajemy się przez $_GET->zmienna.
Czy jest inna możliwość, niż jak w tym przykładzie; sprawdzania które argumenty zostały wykorzstane?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 15:32