2008年8月29日

好話要記在心裡

form my blog in pixnet
clipped from ichuan.pixnet.net

好話要記在心裡

「人生不是得到…就是學到」
我喜歡這句話,很健康的人生觀:
你不是得到一份圓滿的因緣;就是學到怎樣更靠近幸福。
你不是得到勝利;就是學到如何避免失敗。
你不是得到最終自己想要的結果;就是學到…世事總不會盡如人意。
----------------------------------------------------------------------------------------------
我喜歡這句話,退一步思考我想會快樂很多

開心不開心都在一念之間,簡單一點、放開一點、快樂一點~~

集滿三點送大獎,就是笑容一個

哈哈,原諒我的慈光小語的稿還沒繳,有誰可以教教我怎麼開頭的嗎


ichuan 發表在
PIXNET 痞客邦
迴響(0) 引用(0) 人氣(25)

隨筆

這個月因新同事的陸續到位
開始了我如火如荼的趕工生活

即使加班依然要快樂
自己開心加班跟之前被逼著要加班
feel就是有差......

每天嘻嘻哈哈上班,
即使工作的List清單成長的比解決的還快,
即使要看的系統英文說明有一拖拉庫。
但有這些可愛的老闆們加上好笑的又有內涵的同事們,
真的覺得自己很幸運也很幸福。

$user object (continute)

Drupal: Working With Users

Storing Data in the $user Object

The data field in the users table is for holding extra information in a serialized array. To store data, call user_save():

global $user;
$extra_data = array(’disposition’ => t(’Grumpy’));
user_save($user, $extra_data);

To retrieve data, do:

global $user;
print $user->disposition; //Prints ‘Grumpy’

This method creates additional overhead, because the data needs to be unserialized. An alternative method is to implement hook_user('load'), see below.

Adding Data to the $user Object

This can be done with hook_user('load').

$user object

Drupal: Working With Users
The $user Object
The user is represented as the global $user object, which is created during the session phase of the bootstrap process. The $user object is a join of all the fields in the users table and sessions table on the user’s ID. The anonymous user is created by drupal_anonymous_user() and looks like this:

function drupal_anonymous_user($session='') {

$user = new stdClass();
$user->uid = 0;
$user->hostname = $_SERVER['REMOTE_ADDR'];
$user->roles = array();
$user->roles[DRUPAL_ANONYMOUS_RID] = ‘anonymous user’;
$user->session = $session;

return $user;
}

To see the contents of the $user object, do

global $user;
print_r $user;

2008年8月28日

PHP Function To Return Mutiple Values

clipped from www.x-pose.org

PHP Function To Return Mutiple Values

The trick to return more than one value in a function can be applied to any programming language, but this example is in PHP.  Functions are designed to return one value, but there really is no limit to have many values that can be returned.  So lets take a look at the code:

  1. /* Example code */  
  2.   
  3. list($var1, $var2) = returnYankees();  
  4. print "$var1 $var2";  
  5.   
  6. function returnYankees(){  
  7.  $a = "go";  
  8.  $b = "yankees";  
  9.   return array($a,$b);  
  10. }  

The code is self explanitory and I don't think I need to go into too much depth. I will say that the $a or $b values that are returned can also be arrays as well. Now you can make one complex function rather than multiple functions! 

 blog it