Difference between #3 and #5 of
How to create a simple logout link in the view?

Changes

Title unchanged

How to create a simple logout link in the view?

Category unchanged

How-tos

Yii version unchanged

Tags unchanged

Logout, Link, user, URL, views

Content changed

[...]
}
```



### Show Logout only to logged-in users  
------------------
Just wrap an if arround your code and ask if the user is not a guest:
[...]
```

### What Does Not Work
 
 

 
 
```php 
<a href="<?php echo Yii::app()->request->baseUrl; ?>/site/logout">Logout</a>
 
```
 
 
-  
```php 
<a href="Yii::app()->user->logout();echo Yii::app()->homeUrl; ">Logout</a>
 
```
 
0 2
1 follower
Viewed: 47 363 times
Version: 1.1
Category: How-tos
Written by: mi.sarah
Last updated by: CeBe
Created on: Feb 28, 2014
Last updated: 10 years ago
Update Article

Revisions

View all history