Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8206

Re: classes in PHP

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: classes in PHP
Date 2013-02-03 18:11 +0100
Message-ID <an7k1cF1e41U1@mid.uni-berlin.de> (permalink)
References <fd3565a9-3766-4224-bed5-812a0cd11d64@googlegroups.com>

Show all headers | View raw


Am 03.02.2013 18:04, schrieb Rita Ferreira:
> Hi,
> I'm new working with classes in PHP.
> 
> I'm trying to make login, and I have a form in html which the action I would like to go to the login function located in a class file called UserControler.php.
> My form is in a php file but is not inside a class. I can't call the login function, it always give me error, so I tried to call a file called  process.php file where there I call the login function, but it gives me error:
> 
> It's something like this:
> 
> form.php
> 
> <form action="../process.php" method="post">
> (..)
> 
> process.php
> 
> <?php
> require("UserController.php");
> 
> $a=new UserController;
> $a->login();
> ?>
> 
> 
> UserController.php
> <?php
> 
> public class UserController

PHP Parse error:  syntax error, unexpected 'public' (T_PUBLIC) in php shell code on
line 1


> {
> 	
> 	private $obj;
> 
> 	function __construct( ){ }
> 
> 	public function login()
> 	{}
> (..)
> }
> 
> 
> Does anybody can tell me why my code only works until the "$a->login();" in process.php? Is anything wrong?

For development, always turn on every error display and logging directive you can find.

Learn how to check the web server log.

/Str.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

classes in PHP Rita Ferreira <ritaferreira83@gmail.com> - 2013-02-03 09:04 -0800
  Re: classes in PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-03 18:11 +0100
  Re: classes in PHP Rita Ferreira <ritaferreira83@gmail.com> - 2013-02-03 09:49 -0800
    Re: classes in PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-03 19:39 +0100
      Re: classes in PHP Jerry Stuckle <jstucklex@attglobal.net> - 2013-02-04 00:07 -0500
      Re: classes in PHP Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-06 13:29 +0100
        Re: classes in PHP Jerry Stuckle <jstucklex@attglobal.net> - 2013-02-06 08:49 -0500
        Re: classes in PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-07 11:57 +0100
          Re: classes in PHP Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-07 12:17 +0100
          Re: classes in PHP Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-02-07 12:35 +0100
          Re: classes in PHP The Natural Philosopher <tnp@invalid.invalid> - 2013-02-07 11:46 +0000
            Re: classes in PHP "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-02-07 14:46 +0100
    Re: classes in PHP Simon <bad@example.com> - 2013-02-04 09:15 +0200

csiph-web