PHP致命错误:调用未定义的函数getusername()

时间:2017-04-16 23:16:04

标签: php

这是错误我该如何解决?这是所有的代码,我与PHP混淆。我有自动模板生成错误日志,所以我看到了这个,我无法访问profile.php。请帮忙!

<?php
	require_once('./pieces/header.php');
?>
<div class="row">
	<div class="col-sm-8" id="center">
		<div class="panel panel-default">
			<div class="panel-heading">Profile Editor</div>
			<div class="panel-body">
				<form method="POST">
				    <div class="form-group input-group">
						<span class="input-group-addon"><i class="fa fa-github-alt"></i></span>
						<input type="text" class="form-control" value="<?php $user>getUsername(); ?>" title="Account username." disabled />
					</div>
					<div class="form-group input-group">
						<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
						<input type="text" class="form-control" value="<?php $user>getEmail(); ?>" title="Account email." disabled />
					</div>
					<div class="form-group input-group">
						<span class="input-group-addon"><i class="fa fa-trophy"></i></span>
						<input type="text" class="form-control" value="<?php $user>getMembership(); ?>" title="Account membership." disabled />
					</div>
					<div class="form-group input-group">
						<span class="input-group-addon"><i class="fa fa-key"></i></span>
						<input type="password" name="oldpassword" class="form-control"  placeholder="Current Password" title="Current account password." value="" maxlength="32" autocomplete="off" />
					</div>
					<div class="form-group input-group">
						<span class="input-group-addon"><i class="fa fa-key"></i></span>
						<input type="password" name="password" class="form-control"  placeholder="New Password" value="" title="New account password." maxlength="32" autocomplete="off" />
					</div>
					<div class="form-group no-margn">
						<input type="submit" name="save" class="btn btn-success btn-block" value="Save Changes"/>
					</div>
				</form>
			</div>
		</div>
	</div>

2 个答案:

答案 0 :(得分:0)

你的罪恶是错的。 您的:

<?php $user>getUsername(); ?>

正确:

<?php $user->getUsername(); ?>

答案 1 :(得分:-1)

错误'undefined function'是自解释的,它意味着您尝试调用的函数不存在。您的帖子具有“getusername()”函数,而您的代码段具有“getUsername()”函数。请不要在代码段中使用大写的“U”,并记住php是区分大小写的语言。

由于